Skip to content

Commit 02f9fde

Browse files
author
iclsrc
committed
Merge from 'master' to 'sycl-web' (#3)
CONFLICT (modify/delete): llvm/tools/LLVMBuild.txt deleted in 9218ff5 and modified in HEAD. Version HEAD of llvm/tools/LLVMBuild.txt left in tree. CONFLICT (modify/delete): llvm/lib/LLVMBuild.txt deleted in 9218ff5 and modified in HEAD. Version HEAD of llvm/lib/LLVMBuild.txt left in tree.
2 parents c4003fd + 9218ff5 commit 02f9fde

File tree

890 files changed

+18640
-10966
lines changed

Some content is hidden

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

890 files changed

+18640
-10966
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ const ClangTidyOptions &ClangTidyContext::getOptions() const {
205205
ClangTidyOptions ClangTidyContext::getOptionsForFile(StringRef File) const {
206206
// Merge options on top of getDefaults() as a safeguard against options with
207207
// unset values.
208-
return ClangTidyOptions::getDefaults().mergeWith(
208+
return ClangTidyOptions::getDefaults().merge(
209209
OptionsProvider->getOptions(File), 0);
210210
}
211211

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

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ ClangTidyOptions ClangTidyOptions::getDefaults() {
116116
Options.User = llvm::None;
117117
for (const ClangTidyModuleRegistry::entry &Module :
118118
ClangTidyModuleRegistry::entries())
119-
Options = Options.mergeWith(Module.instantiate()->getModuleOptions(), 0);
119+
Options.mergeWith(Module.instantiate()->getModuleOptions(), 0);
120120
return Options;
121121
}
122122

@@ -142,27 +142,31 @@ static void overrideValue(Optional<T> &Dest, const Optional<T> &Src) {
142142
Dest = Src;
143143
}
144144

145-
ClangTidyOptions ClangTidyOptions::mergeWith(const ClangTidyOptions &Other,
146-
unsigned Priority) const {
147-
ClangTidyOptions Result = *this;
148-
149-
mergeCommaSeparatedLists(Result.Checks, Other.Checks);
150-
mergeCommaSeparatedLists(Result.WarningsAsErrors, Other.WarningsAsErrors);
151-
overrideValue(Result.HeaderFilterRegex, Other.HeaderFilterRegex);
152-
overrideValue(Result.SystemHeaders, Other.SystemHeaders);
153-
overrideValue(Result.FormatStyle, Other.FormatStyle);
154-
overrideValue(Result.User, Other.User);
155-
overrideValue(Result.UseColor, Other.UseColor);
156-
mergeVectors(Result.ExtraArgs, Other.ExtraArgs);
157-
mergeVectors(Result.ExtraArgsBefore, Other.ExtraArgsBefore);
145+
ClangTidyOptions &ClangTidyOptions::mergeWith(const ClangTidyOptions &Other,
146+
unsigned Order) {
147+
mergeCommaSeparatedLists(Checks, Other.Checks);
148+
mergeCommaSeparatedLists(WarningsAsErrors, Other.WarningsAsErrors);
149+
overrideValue(HeaderFilterRegex, Other.HeaderFilterRegex);
150+
overrideValue(SystemHeaders, Other.SystemHeaders);
151+
overrideValue(FormatStyle, Other.FormatStyle);
152+
overrideValue(User, Other.User);
153+
overrideValue(UseColor, Other.UseColor);
154+
mergeVectors(ExtraArgs, Other.ExtraArgs);
155+
mergeVectors(ExtraArgsBefore, Other.ExtraArgsBefore);
158156

159157
for (const auto &KeyValue : Other.CheckOptions) {
160-
Result.CheckOptions.insert_or_assign(
158+
CheckOptions.insert_or_assign(
161159
KeyValue.getKey(),
162160
ClangTidyValue(KeyValue.getValue().Value,
163-
KeyValue.getValue().Priority + Priority));
161+
KeyValue.getValue().Priority + Order));
164162
}
163+
return *this;
164+
}
165165

166+
ClangTidyOptions ClangTidyOptions::merge(const ClangTidyOptions &Other,
167+
unsigned Order) const {
168+
ClangTidyOptions Result = *this;
169+
Result.mergeWith(Other, Order);
166170
return Result;
167171
}
168172

@@ -178,8 +182,8 @@ ClangTidyOptions
178182
ClangTidyOptionsProvider::getOptions(llvm::StringRef FileName) {
179183
ClangTidyOptions Result;
180184
unsigned Priority = 0;
181-
for (const auto &Source : getRawOptions(FileName))
182-
Result = Result.mergeWith(Source.first, ++Priority);
185+
for (auto &Source : getRawOptions(FileName))
186+
Result.mergeWith(Source.first, ++Priority);
183187
return Result;
184188
}
185189

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,15 @@ struct ClangTidyOptions {
5555
/// of each registered \c ClangTidyModule.
5656
static ClangTidyOptions getDefaults();
5757

58+
/// Overwrites all fields in here by the fields of \p Other that have a value.
59+
/// \p Order specifies precedence of \p Other option.
60+
ClangTidyOptions &mergeWith(const ClangTidyOptions &Other, unsigned Order);
61+
5862
/// Creates a new \c ClangTidyOptions instance combined from all fields
5963
/// of this instance overridden by the fields of \p Other that have a value.
6064
/// \p Order specifies precedence of \p Other option.
61-
ClangTidyOptions mergeWith(const ClangTidyOptions &Other,
62-
unsigned Order) const;
65+
LLVM_NODISCARD ClangTidyOptions merge(const ClangTidyOptions &Other,
66+
unsigned Order) const;
6367

6468
/// Checks filter.
6569
llvm::Optional<std::string> Checks;

clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider(
319319
if (ParsedConfig)
320320
return std::make_unique<ConfigOptionsProvider>(
321321
GlobalOptions,
322-
ClangTidyOptions::getDefaults().mergeWith(DefaultOptions, 0),
322+
ClangTidyOptions::getDefaults().merge(DefaultOptions, 0),
323323
*ParsedConfig, OverrideOptions, std::move(FS));
324324
llvm::errs() << "Error: invalid configuration specified.\n"
325325
<< ParsedConfig.getError().message() << "\n";
@@ -455,9 +455,8 @@ int clangTidyMain(int argc, const char **argv) {
455455
if (DumpConfig) {
456456
EffectiveOptions.CheckOptions =
457457
getCheckOptions(EffectiveOptions, AllowEnablingAnalyzerAlphaCheckers);
458-
llvm::outs() << configurationAsText(
459-
ClangTidyOptions::getDefaults().mergeWith(
460-
EffectiveOptions, 0))
458+
llvm::outs() << configurationAsText(ClangTidyOptions::getDefaults().merge(
459+
EffectiveOptions, 0))
461460
<< "\n";
462461
return 0;
463462
}

clang-tools-extra/clangd/index/Serialization.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,10 +508,8 @@ llvm::Expected<IndexFileIn> readRIFF(llvm::StringRef Data) {
508508
if (Chunks.count("rela")) {
509509
Reader RelationsReader(Chunks.lookup("rela"));
510510
RelationSlab::Builder Relations;
511-
while (!RelationsReader.eof()) {
512-
auto Relation = readRelation(RelationsReader);
513-
Relations.insert(Relation);
514-
}
511+
while (!RelationsReader.eof())
512+
Relations.insert(readRelation(RelationsReader));
515513
if (RelationsReader.err())
516514
return error("malformed or truncated relations");
517515
Result.Relations = std::move(Relations).build();

clang-tools-extra/unittests/clang-tidy/ClangTidyOptionsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ TEST(ParseConfiguration, MergeConfigurations) {
103103
UseColor: true
104104
)");
105105
ASSERT_TRUE(!!Options2);
106-
ClangTidyOptions Options = Options1->mergeWith(*Options2, 0);
106+
ClangTidyOptions Options = Options1->merge(*Options2, 0);
107107
EXPECT_EQ("check1,check2,check3,check4", *Options.Checks);
108108
EXPECT_EQ("filter2", *Options.HeaderFilterRegex);
109109
EXPECT_EQ("user2", *Options.User);

clang/docs/UsersManual.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,51 @@ Current limitations
747747
translated from debug annotations. That translation can be lossy,
748748
which results in some remarks having no location information.
749749

750+
Options to Emit Resource Consumption Reports
751+
--------------------------------------------
752+
753+
These are options that report execution time and consumed memory of different
754+
compilations steps.
755+
756+
.. option:: -fproc-stat-report=
757+
758+
This option requests driver to print used memory and execution time of each
759+
compilation step. The ``clang`` driver during execution calls different tools,
760+
like compiler, assembler, linker etc. With this option the driver reports
761+
total execution time, the execution time spent in user mode and peak memory
762+
usage of each the called tool. Value of the option specifies where the report
763+
is sent to. If it specifies a regular file, the data are saved to this file in
764+
CSV format:
765+
766+
.. code-block:: console
767+
768+
$ clang -fproc-stat-report=abc foo.c
769+
$ cat abc
770+
clang-11,"/tmp/foo-123456.o",92000,84000,87536
771+
ld,"a.out",900,8000,53568
772+
773+
The data on each row represent:
774+
775+
* file name of the tool executable,
776+
* output file name in quotes,
777+
* total execution time in microseconds,
778+
* execution time in user mode in microseconds,
779+
* peak memory usage in Kb.
780+
781+
It is possible to specify this option without any value. In this case statistics
782+
is printed on standard output in human readable format:
783+
784+
.. code-block:: console
785+
786+
$ clang -fproc-stat-report foo.c
787+
clang-11: output=/tmp/foo-855a8e.o, total=68.000 ms, user=60.000 ms, mem=86920 Kb
788+
ld: output=a.out, total=8.000 ms, user=4.000 ms, mem=52320 Kb
789+
790+
The report file specified in the option is locked for write, so this option
791+
can be used to collect statistics in parallel builds. The report file is not
792+
cleared, new data is appended to it, thus making posible to accumulate build
793+
statistics.
794+
750795
Other Options
751796
-------------
752797
Clang options that don't fit neatly into other categories.

clang/include/clang/Analysis/CallGraph.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ class CallGraph : public RecursiveASTVisitor<CallGraph> {
9191
/// Get the number of nodes in the graph.
9292
unsigned size() const { return FunctionMap.size(); }
9393

94-
/// \ brief Get the virtual root of the graph, all the functions available
95-
/// externally are represented as callees of the node.
94+
/// Get the virtual root of the graph, all the functions available externally
95+
/// are represented as callees of the node.
9696
CallGraphNode *getRoot() const { return Root; }
9797

9898
/// Iterators through all the nodes of the graph that have no parent. These

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def Annotate : InheritableParamAttr {
753753
// '#pragma clang attribute' even though it has no subject list.
754754
let AdditionalMembers = [{
755755
static AnnotateAttr *Create(ASTContext &Ctx, llvm::StringRef Annotation, \
756-
const AttributeCommonInfo &CommonInfo = {SourceRange{}}) {
756+
const AttributeCommonInfo &CommonInfo) {
757757
return AnnotateAttr::Create(Ctx, Annotation, nullptr, 0, CommonInfo);
758758
}
759759
static AnnotateAttr *CreateImplicit(ASTContext &Ctx, llvm::StringRef Annotation, \

clang/include/clang/Driver/Job.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ class Command {
157157
/// See Command::setEnvironment
158158
std::vector<const char *> Environment;
159159

160+
/// Information on executable run provided by OS.
161+
mutable Optional<llvm::sys::ProcessStatistics> ProcStat;
162+
160163
/// When a response file is needed, we try to put most arguments in an
161164
/// exclusive file, while others remains as regular command line arguments.
162165
/// This functions fills a vector with the regular command line arguments,
@@ -238,6 +241,10 @@ class Command {
238241
return OutputFilenames;
239242
}
240243

244+
Optional<llvm::sys::ProcessStatistics> getProcessStatistics() const {
245+
return ProcStat;
246+
}
247+
241248
protected:
242249
/// Optionally print the filenames to be compiled
243250
void PrintFileNames() const;

clang/include/clang/Driver/Options.td

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,8 @@ def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager
13281328
HelpText<"Enables an experimental new pass manager in LLVM.">;
13291329
def fexperimental_strict_floating_point : Flag<["-"], "fexperimental-strict-floating-point">,
13301330
Group<f_clang_Group>, Flags<[CC1Option]>,
1331-
HelpText<"Enables experimental strict floating point in LLVM.">;
1331+
HelpText<"Enables experimental strict floating point in LLVM.">,
1332+
MarshallingInfoFlag<"LangOpts->ExpStrictFP">;
13321333
def finput_charset_EQ : Joined<["-"], "finput-charset=">, Group<f_Group>;
13331334
def fexec_charset_EQ : Joined<["-"], "fexec-charset=">, Group<f_Group>;
13341335
def finstrument_functions : Flag<["-"], "finstrument-functions">, Group<f_Group>, Flags<[CC1Option]>,
@@ -2029,6 +2030,10 @@ can be analyzed with chrome://tracing or `Speedscope App
20292030
def ftime_trace_granularity_EQ : Joined<["-"], "ftime-trace-granularity=">, Group<f_Group>,
20302031
HelpText<"Minimum time granularity (in microseconds) traced by time profiler">,
20312032
Flags<[CC1Option, CoreOption]>;
2033+
def fproc_stat_report : Joined<["-"], "fproc-stat-report">, Group<f_Group>,
2034+
HelpText<"Print subprocess statistics">;
2035+
def fproc_stat_report_EQ : Joined<["-"], "fproc-stat-report=">, Group<f_Group>,
2036+
HelpText<"Save subprocess statistics to the given file">;
20322037
def ftlsmodel_EQ : Joined<["-"], "ftls-model=">, Group<f_Group>, Flags<[CC1Option]>;
20332038
def ftrapv : Flag<["-"], "ftrapv">, Group<f_Group>, Flags<[CC1Option]>,
20342039
HelpText<"Trap on integer overflow">;

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9397,6 +9397,8 @@ class Sema final {
93979397
LateInstantiatedAttrVec *LateAttrs = nullptr,
93989398
LocalInstantiationScope *OuterMostScope = nullptr);
93999399

9400+
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor);
9401+
94009402
bool usesPartialOrExplicitSpecialization(
94019403
SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec);
94029404

clang/include/clang/Tooling/Syntax/Nodes.h

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -156,113 +156,6 @@ class CallArguments final : public List {
156156
std::vector<List::ElementAndDelimiter<Expression>> getArgumentsAndCommas();
157157
};
158158

159-
/// Expression for literals. C++ [lex.literal]
160-
class LiteralExpression : public Expression {
161-
public:
162-
LiteralExpression(NodeKind K) : Expression(K) {}
163-
static bool classof(const Node *N);
164-
Leaf *getLiteralToken();
165-
};
166-
167-
/// Expression for integer literals. C++ [lex.icon]
168-
class IntegerLiteralExpression final : public LiteralExpression {
169-
public:
170-
IntegerLiteralExpression()
171-
: LiteralExpression(NodeKind::IntegerLiteralExpression) {}
172-
static bool classof(const Node *N);
173-
};
174-
175-
/// Expression for character literals. C++ [lex.ccon]
176-
class CharacterLiteralExpression final : public LiteralExpression {
177-
public:
178-
CharacterLiteralExpression()
179-
: LiteralExpression(NodeKind::CharacterLiteralExpression) {}
180-
static bool classof(const Node *N);
181-
};
182-
183-
/// Expression for floating-point literals. C++ [lex.fcon]
184-
class FloatingLiteralExpression final : public LiteralExpression {
185-
public:
186-
FloatingLiteralExpression()
187-
: LiteralExpression(NodeKind::FloatingLiteralExpression) {}
188-
static bool classof(const Node *N);
189-
};
190-
191-
/// Expression for string-literals. C++ [lex.string]
192-
class StringLiteralExpression final : public LiteralExpression {
193-
public:
194-
StringLiteralExpression()
195-
: LiteralExpression(NodeKind::StringLiteralExpression) {}
196-
static bool classof(const Node *N);
197-
};
198-
199-
/// Expression for boolean literals. C++ [lex.bool]
200-
class BoolLiteralExpression final : public LiteralExpression {
201-
public:
202-
BoolLiteralExpression()
203-
: LiteralExpression(NodeKind::BoolLiteralExpression) {}
204-
static bool classof(const Node *N);
205-
};
206-
207-
/// Expression for the `nullptr` literal. C++ [lex.nullptr]
208-
class CxxNullPtrExpression final : public LiteralExpression {
209-
public:
210-
CxxNullPtrExpression() : LiteralExpression(NodeKind::CxxNullPtrExpression) {}
211-
static bool classof(const Node *N);
212-
};
213-
214-
/// Expression for user-defined literal. C++ [lex.ext]
215-
/// user-defined-literal:
216-
/// user-defined-integer-literal
217-
/// user-defined-floating-point-literal
218-
/// user-defined-string-literal
219-
/// user-defined-character-literal
220-
class UserDefinedLiteralExpression : public LiteralExpression {
221-
public:
222-
UserDefinedLiteralExpression(NodeKind K) : LiteralExpression(K) {}
223-
static bool classof(const Node *N);
224-
};
225-
226-
/// Expression for user-defined-integer-literal. C++ [lex.ext]
227-
class IntegerUserDefinedLiteralExpression final
228-
: public UserDefinedLiteralExpression {
229-
public:
230-
IntegerUserDefinedLiteralExpression()
231-
: UserDefinedLiteralExpression(
232-
NodeKind::IntegerUserDefinedLiteralExpression) {}
233-
static bool classof(const Node *N);
234-
};
235-
236-
/// Expression for user-defined-floating-point-literal. C++ [lex.ext]
237-
class FloatUserDefinedLiteralExpression final
238-
: public UserDefinedLiteralExpression {
239-
public:
240-
FloatUserDefinedLiteralExpression()
241-
: UserDefinedLiteralExpression(
242-
NodeKind::FloatUserDefinedLiteralExpression) {}
243-
static bool classof(const Node *N);
244-
};
245-
246-
/// Expression for user-defined-character-literal. C++ [lex.ext]
247-
class CharUserDefinedLiteralExpression final
248-
: public UserDefinedLiteralExpression {
249-
public:
250-
CharUserDefinedLiteralExpression()
251-
: UserDefinedLiteralExpression(
252-
NodeKind::CharUserDefinedLiteralExpression) {}
253-
static bool classof(const Node *N);
254-
};
255-
256-
/// Expression for user-defined-string-literal. C++ [lex.ext]
257-
class StringUserDefinedLiteralExpression final
258-
: public UserDefinedLiteralExpression {
259-
public:
260-
StringUserDefinedLiteralExpression()
261-
: UserDefinedLiteralExpression(
262-
NodeKind::StringUserDefinedLiteralExpression) {}
263-
static bool classof(const Node *N);
264-
};
265-
266159
/// An abstract class for prefix and postfix unary operators.
267160
class UnaryOperatorExpression : public Expression {
268161
public:

0 commit comments

Comments
 (0)