Skip to content

Commit bcaa1ca

Browse files
committed
Merge commit 'b4655a0815d0cd75297cfe323526397ee7a03dca' into llvmspirv_pulldown
2 parents 34d8419 + b4655a0 commit bcaa1ca

File tree

721 files changed

+647853
-460584
lines changed

Some content is hidden

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

721 files changed

+647853
-460584
lines changed

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@
2222
#include "ExpandModularHeadersPPCallbacks.h"
2323
#include "clang-tidy-config.h"
2424
#include "clang/AST/ASTConsumer.h"
25-
#include "clang/AST/ASTContext.h"
26-
#include "clang/AST/Decl.h"
2725
#include "clang/ASTMatchers/ASTMatchFinder.h"
2826
#include "clang/Format/Format.h"
2927
#include "clang/Frontend/ASTConsumers.h"
3028
#include "clang/Frontend/CompilerInstance.h"
31-
#include "clang/Frontend/FrontendActions.h"
3229
#include "clang/Frontend/FrontendDiagnostic.h"
3330
#include "clang/Frontend/MultiplexConsumer.h"
3431
#include "clang/Frontend/TextDiagnosticPrinter.h"
@@ -43,7 +40,6 @@
4340
#include "clang/Tooling/ReplacementsYaml.h"
4441
#include "clang/Tooling/Tooling.h"
4542
#include "llvm/Support/Process.h"
46-
#include "llvm/Support/Signals.h"
4743
#include <algorithm>
4844
#include <utility>
4945

clang-tools-extra/clang-tidy/ClangTidyCheck.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
#include "llvm/ADT/SmallString.h"
1111
#include "llvm/ADT/StringRef.h"
1212
#include "llvm/Support/Error.h"
13-
#include "llvm/Support/WithColor.h"
1413
#include "llvm/Support/YAMLParser.h"
15-
#include "llvm/Support/raw_ostream.h"
1614

1715
namespace clang {
1816
namespace tidy {

clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,24 @@
2323
#include "clang/AST/Attr.h"
2424
#include "clang/Basic/Diagnostic.h"
2525
#include "clang/Basic/DiagnosticOptions.h"
26-
#include "clang/Basic/FileManager.h"
2726
#include "clang/Basic/SourceManager.h"
2827
#include "clang/Frontend/DiagnosticRenderer.h"
2928
#include "clang/Tooling/Core/Diagnostic.h"
3029
#include "clang/Tooling/Core/Replacement.h"
3130
#include "llvm/ADT/STLExtras.h"
3231
#include "llvm/ADT/SmallString.h"
3332
#include "llvm/ADT/StringMap.h"
34-
#include "llvm/Support/ErrorHandling.h"
3533
#include "llvm/Support/FormatVariadic.h"
3634
#include "llvm/Support/Regex.h"
3735
#include <tuple>
3836
#include <vector>
3937
using namespace clang;
4038
using namespace tidy;
4139

40+
#ifdef LLVM_CLANG_AST_ATTR_H
41+
//#error
42+
#endif
43+
4244
namespace {
4345
class ClangTidyDiagnosticRenderer : public DiagnosticRenderer {
4446
public:

clang-tools-extra/clang-tidy/ClangTidyModule.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include "llvm/ADT/StringMap.h"
1414
#include "llvm/ADT/StringRef.h"
1515
#include <functional>
16-
#include <map>
1716
#include <memory>
18-
#include <string>
1917

2018
namespace clang {
2119
namespace tidy {

clang-tools-extra/clang-tidy/ClangTidyOptions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "llvm/Support/MemoryBufferRef.h"
1717
#include "llvm/Support/Path.h"
1818
#include "llvm/Support/YAMLTraits.h"
19-
#include "llvm/Support/raw_ostream.h"
2019
#include <utility>
2120

2221
#define DEBUG_TYPE "clang-tidy-options"

clang-tools-extra/clang-tidy/ClangTidyProfiling.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "ClangTidyProfiling.h"
10-
#include "llvm/ADT/STLExtras.h"
1110
#include "llvm/ADT/SmallString.h"
1211
#include "llvm/Support/FileSystem.h"
1312
#include "llvm/Support/Path.h"
14-
#include "llvm/Support/YAMLTraits.h"
1513
#include "llvm/Support/raw_ostream.h"
1614
#include <system_error>
1715
#include <utility>

clang-tools-extra/clangd/CodeComplete.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,18 @@ struct CompletionCandidate {
182182
// strings (literal or URI) mapping to the same file. We still want to
183183
// bundle those, so we must resolve the header to be included here.
184184
std::string HeaderForHash;
185-
if (Inserter)
186-
if (auto Header = headerToInsertIfAllowed(Opts))
187-
if (auto HeaderFile = toHeaderFile(*Header, FileName))
185+
if (Inserter) {
186+
if (auto Header = headerToInsertIfAllowed(Opts)) {
187+
if (auto HeaderFile = toHeaderFile(*Header, FileName)) {
188188
if (auto Spelled =
189189
Inserter->calculateIncludePath(*HeaderFile, FileName))
190190
HeaderForHash = *Spelled;
191+
} else {
192+
vlog("Code completion header path manipulation failed {0}",
193+
HeaderFile.takeError());
194+
}
195+
}
196+
}
191197

192198
llvm::SmallString<256> Scratch;
193199
if (IndexResult) {

clang-tools-extra/clangd/GlobalCompilationDatabase.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,14 @@ void DirectoryBasedGlobalCompilationDatabase::broadcastCDB(
511511
// Given that we know that CDBs have been moved/generated, don't trust caches.
512512
// (This should be rare, so it's OK to add a little latency).
513513
constexpr auto IgnoreCache = std::chrono::steady_clock::time_point::max();
514-
for (DirectoryCache *Dir : getDirectoryCaches(FileAncestors)) {
514+
auto DirectoryCaches = getDirectoryCaches(FileAncestors);
515+
assert(DirectoryCaches.size() == FileAncestors.size());
516+
for (unsigned I = 0; I < DirectoryCaches.size(); ++I) {
515517
bool ShouldBroadcast = false;
516-
if (Dir->get(Opts.TFS, ShouldBroadcast, /*FreshTime=*/IgnoreCache,
517-
/*FreshTimeMissing=*/IgnoreCache))
518-
DirectoryHasCDB.find(Dir->Path)->setValue(true);
518+
if (DirectoryCaches[I]->get(Opts.TFS, ShouldBroadcast,
519+
/*FreshTime=*/IgnoreCache,
520+
/*FreshTimeMissing=*/IgnoreCache))
521+
DirectoryHasCDB.find(FileAncestors[I])->setValue(true);
519522
}
520523

521524
std::vector<std::string> GovernedFiles;

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,6 +2839,16 @@ the configuration (without a prefix: ``Auto``).
28392839
int a = 5; vs. int a= 5;
28402840
a += 42; a+= 42;
28412841

2842+
**SpaceBeforeCaseColon** (``bool``)
2843+
If ``false``, spaces will be removed before case colon.
2844+
2845+
.. code-block:: c++
2846+
2847+
true: false
2848+
switch (x) { vs. switch (x) {
2849+
case 1 : break; case 1: break;
2850+
} }
2851+
28422852
**SpaceBeforeCpp11BracedList** (``bool``)
28432853
If ``true``, a space will be inserted before a C++11 braced list
28442854
used to initialize an object (after the preceding identifier or type).

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ clang-format
293293

294294
- Option ``IndentPragmas`` has been added to allow #pragma to indented with the current scope level. This is especially useful when using #pragma to mark OpenMP sections of code.
295295

296+
- Option ``SpaceBeforeCaseColon`` has been added to add a space before the
297+
colon in a case or default statement.
298+
296299

297300
libclang
298301
--------

clang/docs/tools/dump_format_style.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class State(object):
144144
comment += clean_comment_line(line)
145145
elif line.startswith('enum'):
146146
state = State.InEnum
147-
name = re.sub(r'enum\s+(\w+)\s*\{', '\\1', line)
147+
name = re.sub(r'enum\s+(\w+)\s*(:((\s*\w+)+)\s*)?\{', '\\1', line)
148148
enum = Enum(name, comment)
149149
elif line.startswith('struct'):
150150
state = State.InNestedStruct

clang/include/clang/AST/Decl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,9 @@ class ParmVarDecl : public VarDecl {
16651665
return ParmVarDeclBits.IsObjCMethodParam;
16661666
}
16671667

1668+
/// Determines whether this parameter is destroyed in the callee function.
1669+
bool isDestroyedInCallee() const;
1670+
16681671
unsigned getFunctionScopeDepth() const {
16691672
if (ParmVarDeclBits.IsObjCMethodParam) return 0;
16701673
return ParmVarDeclBits.ScopeDepthOrObjCQuals;

clang/include/clang/Basic/FileEntry.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include "llvm/Support/FileSystem/UniqueID.h"
2626

2727
namespace llvm {
28+
29+
class MemoryBuffer;
30+
2831
namespace vfs {
2932

3033
class File;
@@ -67,6 +70,7 @@ class FileEntryRef {
6770
inline unsigned getUID() const;
6871
inline const llvm::sys::fs::UniqueID &getUniqueID() const;
6972
inline time_t getModificationTime() const;
73+
inline bool isNamedPipe() const;
7074
inline void closeFile() const;
7175

7276
/// Check if the underlying FileEntry is the same, intentially ignoring
@@ -339,6 +343,9 @@ class FileEntry {
339343
/// The open file, if it is owned by the \p FileEntry.
340344
mutable std::unique_ptr<llvm::vfs::File> File;
341345

346+
/// The file content, if it is owned by the \p FileEntry.
347+
std::unique_ptr<llvm::MemoryBuffer> Content;
348+
342349
// First access name for this FileEntry.
343350
//
344351
// This is Optional only to allow delayed construction (FileEntryRef has no
@@ -390,6 +397,8 @@ time_t FileEntryRef::getModificationTime() const {
390397
return getFileEntry().getModificationTime();
391398
}
392399

400+
bool FileEntryRef::isNamedPipe() const { return getFileEntry().isNamedPipe(); }
401+
393402
void FileEntryRef::closeFile() const { getFileEntry().closeFile(); }
394403

395404
} // end namespace clang

clang/include/clang/Basic/FileManager.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ class FileManager : public RefCountedBase<FileManager> {
9999
std::unique_ptr<llvm::StringMap<llvm::ErrorOr<FileEntryRef::MapValue>>>
100100
SeenBypassFileEntries;
101101

102+
/// The file entry for stdin, if it has been accessed through the FileManager.
103+
Optional<FileEntryRef> STDIN;
104+
102105
/// The canonical names of files and directories .
103106
llvm::DenseMap<const void *, llvm::StringRef> CanonicalNames;
104107

@@ -217,6 +220,14 @@ class FileManager : public RefCountedBase<FileManager> {
217220
bool OpenFile = false,
218221
bool CacheFailure = true);
219222

223+
/// Get the FileEntryRef for stdin, returning an error if stdin cannot be
224+
/// read.
225+
///
226+
/// This reads and caches stdin before returning. Subsequent calls return the
227+
/// same file entry, and a reference to the cached input is returned by calls
228+
/// to getBufferForFile.
229+
llvm::Expected<FileEntryRef> getSTDIN();
230+
220231
/// Get a FileEntryRef if it exists, without doing anything on error.
221232
llvm::Optional<FileEntryRef> getOptionalFileRef(StringRef Filename,
222233
bool OpenFile = false,

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,8 +1859,7 @@ def fsystem_module : Flag<["-"], "fsystem-module">, Flags<[CC1Option]>,
18591859
MarshallingInfoFlag<"FrontendOpts.IsSystemModule">;
18601860
def fmodule_map_file : Joined<["-"], "fmodule-map-file=">,
18611861
Group<f_Group>, Flags<[NoXarchOption,CC1Option]>, MetaVarName<"<file>">,
1862-
HelpText<"Load this module map file">,
1863-
MarshallingInfoStringVector<"FrontendOpts.ModuleMapFiles">;
1862+
HelpText<"Load this module map file">;
18641863
def fmodule_file : Joined<["-"], "fmodule-file=">,
18651864
Group<i_Group>, Flags<[NoXarchOption,CC1Option]>, MetaVarName<"[<name>=]<file>">,
18661865
HelpText<"Specify the mapping of module name to precompiled module file, or load a module file if name is omitted.">;
@@ -4720,7 +4719,7 @@ def arcmt_action_EQ : Joined<["-"], "arcmt-action=">, Flags<[CC1Option, NoDriver
47204719
NormalizedValuesScope<"FrontendOptions">,
47214720
NormalizedValues<["ARCMT_Check", "ARCMT_Modify", "ARCMT_Migrate"]>,
47224721
MarshallingInfoString<"FrontendOpts.ARCMTAction", "ARCMT_None">,
4723-
AutoNormalizeEnum;
4722+
AutoNormalizeEnumJoined;
47244723

47254724
def opt_record_file : Separate<["-"], "opt-record-file">,
47264725
HelpText<"File name to use for YAML optimization record output">;

0 commit comments

Comments
 (0)