Skip to content

Commit 5cdec66

Browse files
Merge from 'master' to 'sycl-web' (intel#36)
CONFLICT (content): Merge conflict in clang/test/CodeGenOpenCL/convergent.cl
2 parents aa2075a + c1e3d38 commit 5cdec66

File tree

126 files changed

+2607
-1276
lines changed

Some content is hidden

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

126 files changed

+2607
-1276
lines changed

clang-tools-extra/clangd/indexer/IndexerMain.cpp

+16-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ class IndexActionFactory : public tooling::FrontendActionFactory {
4343
std::unique_ptr<FrontendAction> create() override {
4444
SymbolCollector::Options Opts;
4545
Opts.CountReferences = true;
46+
Opts.FileFilter = [&](const SourceManager &SM, FileID FID) {
47+
const auto *F = SM.getFileEntryForID(FID);
48+
if (!F)
49+
return false; // Skip invalid files.
50+
auto AbsPath = getCanonicalPath(F, SM);
51+
if (!AbsPath)
52+
return false; // Skip files without absolute path.
53+
std::lock_guard<std::mutex> Lock(FilesMu);
54+
return Files.insert(*AbsPath).second; // Skip already processed files.
55+
};
4656
return createStaticIndexingAction(
4757
Opts,
4858
[&](SymbolSlab S) {
@@ -56,15 +66,15 @@ class IndexActionFactory : public tooling::FrontendActionFactory {
5666
}
5767
},
5868
[&](RefSlab S) {
59-
std::lock_guard<std::mutex> Lock(SymbolsMu);
69+
std::lock_guard<std::mutex> Lock(RefsMu);
6070
for (const auto &Sym : S) {
6171
// Deduplication happens during insertion.
6272
for (const auto &Ref : Sym.second)
6373
Refs.insert(Sym.first, Ref);
6474
}
6575
},
6676
[&](RelationSlab S) {
67-
std::lock_guard<std::mutex> Lock(SymbolsMu);
77+
std::lock_guard<std::mutex> Lock(RelsMu);
6878
for (const auto &R : S) {
6979
Relations.insert(R);
7080
}
@@ -82,9 +92,13 @@ class IndexActionFactory : public tooling::FrontendActionFactory {
8292

8393
private:
8494
IndexFileIn &Result;
95+
std::mutex FilesMu;
96+
llvm::StringSet<> Files;
8597
std::mutex SymbolsMu;
8698
SymbolSlab::Builder Symbols;
99+
std::mutex RefsMu;
87100
RefSlab::Builder Refs;
101+
std::mutex RelsMu;
88102
RelationSlab::Builder Relations;
89103
};
90104

clang/include/clang/Driver/Options.td

+36-18
Original file line numberDiff line numberDiff line change
@@ -342,36 +342,53 @@ def ccc_objcmt_migrate : Separate<["-"], "ccc-objcmt-migrate">,
342342
InternalDriverOpt,
343343
HelpText<"Apply modifications and produces temporary files to migrate to "
344344
"modern ObjC syntax">;
345+
345346
def objcmt_migrate_literals : Flag<["-"], "objcmt-migrate-literals">, Flags<[CC1Option]>,
346-
HelpText<"Enable migration to modern ObjC literals">;
347+
HelpText<"Enable migration to modern ObjC literals">,
348+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_Literals">;
347349
def objcmt_migrate_subscripting : Flag<["-"], "objcmt-migrate-subscripting">, Flags<[CC1Option]>,
348-
HelpText<"Enable migration to modern ObjC subscripting">;
350+
HelpText<"Enable migration to modern ObjC subscripting">,
351+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_Subscripting">;
349352
def objcmt_migrate_property : Flag<["-"], "objcmt-migrate-property">, Flags<[CC1Option]>,
350-
HelpText<"Enable migration to modern ObjC property">;
353+
HelpText<"Enable migration to modern ObjC property">,
354+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_Property">;
351355
def objcmt_migrate_all : Flag<["-"], "objcmt-migrate-all">, Flags<[CC1Option]>,
352-
HelpText<"Enable migration to modern ObjC">;
356+
HelpText<"Enable migration to modern ObjC">,
357+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_MigrateDecls">;
353358
def objcmt_migrate_readonly_property : Flag<["-"], "objcmt-migrate-readonly-property">, Flags<[CC1Option]>,
354-
HelpText<"Enable migration to modern ObjC readonly property">;
359+
HelpText<"Enable migration to modern ObjC readonly property">,
360+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_ReadonlyProperty">;
355361
def objcmt_migrate_readwrite_property : Flag<["-"], "objcmt-migrate-readwrite-property">, Flags<[CC1Option]>,
356-
HelpText<"Enable migration to modern ObjC readwrite property">;
362+
HelpText<"Enable migration to modern ObjC readwrite property">,
363+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_ReadwriteProperty">;
357364
def objcmt_migrate_property_dot_syntax : Flag<["-"], "objcmt-migrate-property-dot-syntax">, Flags<[CC1Option]>,
358-
HelpText<"Enable migration of setter/getter messages to property-dot syntax">;
365+
HelpText<"Enable migration of setter/getter messages to property-dot syntax">,
366+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_PropertyDotSyntax">;
359367
def objcmt_migrate_annotation : Flag<["-"], "objcmt-migrate-annotation">, Flags<[CC1Option]>,
360-
HelpText<"Enable migration to property and method annotations">;
368+
HelpText<"Enable migration to property and method annotations">,
369+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_Annotation">;
361370
def objcmt_migrate_instancetype : Flag<["-"], "objcmt-migrate-instancetype">, Flags<[CC1Option]>,
362-
HelpText<"Enable migration to infer instancetype for method result type">;
371+
HelpText<"Enable migration to infer instancetype for method result type">,
372+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_Instancetype">;
363373
def objcmt_migrate_nsmacros : Flag<["-"], "objcmt-migrate-ns-macros">, Flags<[CC1Option]>,
364-
HelpText<"Enable migration to NS_ENUM/NS_OPTIONS macros">;
374+
HelpText<"Enable migration to NS_ENUM/NS_OPTIONS macros">,
375+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_NsMacros">;
365376
def objcmt_migrate_protocol_conformance : Flag<["-"], "objcmt-migrate-protocol-conformance">, Flags<[CC1Option]>,
366-
HelpText<"Enable migration to add protocol conformance on classes">;
377+
HelpText<"Enable migration to add protocol conformance on classes">,
378+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_ProtocolConformance">;
367379
def objcmt_atomic_property : Flag<["-"], "objcmt-atomic-property">, Flags<[CC1Option]>,
368-
HelpText<"Make migration to 'atomic' properties">;
380+
HelpText<"Make migration to 'atomic' properties">,
381+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_AtomicProperty">;
369382
def objcmt_returns_innerpointer_property : Flag<["-"], "objcmt-returns-innerpointer-property">, Flags<[CC1Option]>,
370-
HelpText<"Enable migration to annotate property with NS_RETURNS_INNER_POINTER">;
383+
HelpText<"Enable migration to annotate property with NS_RETURNS_INNER_POINTER">,
384+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_ReturnsInnerPointerProperty">;
371385
def objcmt_ns_nonatomic_iosonly: Flag<["-"], "objcmt-ns-nonatomic-iosonly">, Flags<[CC1Option]>,
372-
HelpText<"Enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's 'atomic' attribute">;
386+
HelpText<"Enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's 'atomic' attribute">,
387+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_NsAtomicIOSOnlyProperty">;
373388
def objcmt_migrate_designated_init : Flag<["-"], "objcmt-migrate-designated-init">, Flags<[CC1Option]>,
374-
HelpText<"Enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods">;
389+
HelpText<"Enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods">,
390+
MarshallingInfoBitfieldFlag<"FrontendOpts.ObjCMTAction", "FrontendOptions::ObjCMT_DesignatedInitializer">;
391+
375392
def objcmt_whitelist_dir_path: Joined<["-"], "objcmt-whitelist-dir-path=">, Flags<[CC1Option]>,
376393
HelpText<"Only modify files with a filename contained in the provided directory path">;
377394
// The misspelt "white-list" [sic] alias is due for removal.
@@ -383,7 +400,7 @@ def ccc_ : Joined<["-"], "ccc-">, Group<internal_Group>, Flags<[Unsupported]>;
383400

384401
// Standard Options
385402

386-
def _HASH_HASH_HASH : Flag<["-"], "###">, Flags<[NoXarchOption, CoreOption]>,
403+
def _HASH_HASH_HASH : Flag<["-"], "###">, Flags<[NoXarchOption, CoreOption, FlangOption]>,
387404
HelpText<"Print (but do not run) the commands to run for this compilation">;
388405
def _DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>,
389406
Flags<[NoXarchOption, CoreOption]>;
@@ -608,7 +625,7 @@ def cl_no_signed_zeros : Flag<["-"], "cl-no-signed-zeros">, Group<opencl_Group>,
608625
HelpText<"OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.">,
609626
MarshallingInfoFlag<"LangOpts->CLNoSignedZero">;
610627
def cl_std_EQ : Joined<["-"], "cl-std=">, Group<opencl_Group>, Flags<[CC1Option]>,
611-
HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,cl3.0,CL3.0,clc++,CLC++">;
628+
HelpText<"OpenCL language standard to compile for.">, Values<"cl,CL,cl1.0,CL1.0,cl1.1,CL1.1,cl1.2,CL1.2,cl2.0,CL2.0,cl3.0,CL3.0,clc++,CLC++">;
612629
def cl_denorms_are_zero : Flag<["-"], "cl-denorms-are-zero">, Group<opencl_Group>,
613630
HelpText<"OpenCL only. Allow denormals to be flushed to zero.">;
614631
def cl_fp32_correctly_rounded_divide_sqrt : Flag<["-"], "cl-fp32-correctly-rounded-divide-sqrt">, Group<opencl_Group>, Flags<[CC1Option]>,
@@ -1288,7 +1305,8 @@ defm rewrite_includes : OptInFFlag<"rewrite-includes", "">;
12881305

12891306
defm delete_null_pointer_checks : OptOutFFlag<"delete-null-pointer-checks",
12901307
"Treat usage of null pointers as undefined behavior (default)",
1291-
"Do not treat usage of null pointers as undefined behavior">;
1308+
"Do not treat usage of null pointers as undefined behavior",
1309+
"", [CoreOption]>;
12921310

12931311
def frewrite_map_file : Separate<["-"], "frewrite-map-file">,
12941312
Group<f_Group>,

clang/include/clang/Tooling/Syntax/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ clang_tablegen(Nodes.inc -gen-clang-syntax-node-list
22
SOURCE Nodes.td
33
TARGET ClangSyntaxNodeList)
44

5+
clang_tablegen(NodeClasses.inc -gen-clang-syntax-node-classes
6+
SOURCE Nodes.td
7+
TARGET ClangSyntaxNodeClasses)

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

+1-128
Original file line numberDiff line numberDiff line change
@@ -114,67 +114,7 @@ enum class NodeRole : uint8_t {
114114
/// For debugging purposes.
115115
raw_ostream &operator<<(raw_ostream &OS, NodeRole R);
116116

117-
class SimpleDeclarator;
118-
119-
/// A root node for a translation unit. Parent is always null.
120-
class TranslationUnit final : public Tree {
121-
public:
122-
TranslationUnit() : Tree(NodeKind::TranslationUnit) {}
123-
static bool classof(const Node *N);
124-
};
125-
126-
/// A base class for all expressions. Note that expressions are not statements,
127-
/// even though they are in clang.
128-
class Expression : public Tree {
129-
public:
130-
Expression(NodeKind K) : Tree(K) {}
131-
static bool classof(const Node *N);
132-
};
133-
134-
/// A sequence of these specifiers make a `nested-name-specifier`.
135-
/// e.g. the `std` or `vector<int>` in `std::vector<int>::size`.
136-
class NameSpecifier : public Tree {
137-
public:
138-
NameSpecifier(NodeKind K) : Tree(K) {}
139-
static bool classof(const Node *N);
140-
};
141-
142-
/// The global namespace name specifier, this specifier doesn't correspond to a
143-
/// token instead an absence of tokens before a `::` characterizes it, in
144-
/// `::std::vector<int>` it would be characterized by the absence of a token
145-
/// before the first `::`
146-
class GlobalNameSpecifier final : public NameSpecifier {
147-
public:
148-
GlobalNameSpecifier() : NameSpecifier(NodeKind::GlobalNameSpecifier) {}
149-
static bool classof(const Node *N);
150-
};
151-
152-
/// A name specifier holding a decltype, of the form: `decltype ( expression ) `
153-
/// e.g. the `decltype(s)` in `decltype(s)::size`.
154-
class DecltypeNameSpecifier final : public NameSpecifier {
155-
public:
156-
DecltypeNameSpecifier() : NameSpecifier(NodeKind::DecltypeNameSpecifier) {}
157-
static bool classof(const Node *N);
158-
};
159-
160-
/// A identifier name specifier, of the form `identifier`
161-
/// e.g. the `std` in `std::vector<int>::size`.
162-
class IdentifierNameSpecifier final : public NameSpecifier {
163-
public:
164-
IdentifierNameSpecifier()
165-
: NameSpecifier(NodeKind::IdentifierNameSpecifier) {}
166-
static bool classof(const Node *N);
167-
};
168-
169-
/// A name specifier with a simple-template-id, of the form `template_opt
170-
/// identifier < template-args >` e.g. the `vector<int>` in
171-
/// `std::vector<int>::size`.
172-
class SimpleTemplateNameSpecifier final : public NameSpecifier {
173-
public:
174-
SimpleTemplateNameSpecifier()
175-
: NameSpecifier(NodeKind::SimpleTemplateNameSpecifier) {}
176-
static bool classof(const Node *N);
177-
};
117+
#include "clang/Tooling/Syntax/NodeClasses.inc"
178118

179119
/// Models a `nested-name-specifier`. C++ [expr.prim.id.qual]
180120
/// e.g. the `std::vector<int>::` in `std::vector<int>::size`.
@@ -195,22 +135,6 @@ class UnqualifiedId final : public Tree {
195135
static bool classof(const Node *N);
196136
};
197137

198-
/// Models an `id-expression`, e.g. `std::vector<int>::size`.
199-
/// C++ [expr.prim.id]
200-
/// id-expression:
201-
/// unqualified-id
202-
/// qualified-id
203-
/// qualified-id:
204-
/// nested-name-specifier template_opt unqualified-id
205-
class IdExpression final : public Expression {
206-
public:
207-
IdExpression() : Expression(NodeKind::IdExpression) {}
208-
static bool classof(const Node *N);
209-
NestedNameSpecifier *getQualifier();
210-
Leaf *getTemplateKeyword();
211-
UnqualifiedId *getUnqualifiedId();
212-
};
213-
214138
/// An expression of an unknown kind, i.e. one not currently handled by the
215139
/// syntax tree.
216140
class UnknownExpression final : public Expression {
@@ -219,14 +143,6 @@ class UnknownExpression final : public Expression {
219143
static bool classof(const Node *N);
220144
};
221145

222-
/// Models a this expression `this`. C++ [expr.prim.this]
223-
class ThisExpression final : public Expression {
224-
public:
225-
ThisExpression() : Expression(NodeKind::ThisExpression) {}
226-
static bool classof(const Node *N);
227-
Leaf *getThisKeyword();
228-
};
229-
230146
/// Models arguments of a function call.
231147
/// call-arguments:
232148
/// delimited_list(expression, ',')
@@ -240,49 +156,6 @@ class CallArguments final : public List {
240156
std::vector<List::ElementAndDelimiter<Expression>> getArgumentsAndCommas();
241157
};
242158

243-
/// A function call. C++ [expr.call]
244-
/// call-expression:
245-
/// expression '(' call-arguments ')'
246-
/// e.g `f(1, '2')` or `this->Base::f()`
247-
class CallExpression final : public Expression {
248-
public:
249-
CallExpression() : Expression(NodeKind::CallExpression) {}
250-
static bool classof(const Node *N);
251-
Expression *getCallee();
252-
Leaf *getOpenParen();
253-
CallArguments *getArguments();
254-
Leaf *getCloseParen();
255-
};
256-
257-
/// Models a parenthesized expression `(E)`. C++ [expr.prim.paren]
258-
/// e.g. `(3 + 2)` in `a = 1 + (3 + 2);`
259-
class ParenExpression final : public Expression {
260-
public:
261-
ParenExpression() : Expression(NodeKind::ParenExpression) {}
262-
static bool classof(const Node *N);
263-
Leaf *getOpenParen();
264-
Expression *getSubExpression();
265-
Leaf *getCloseParen();
266-
};
267-
268-
/// Models a class member access. C++ [expr.ref]
269-
/// member-expression:
270-
/// expression -> template_opt id-expression
271-
/// expression . template_opt id-expression
272-
/// e.g. `x.a`, `xp->a`
273-
///
274-
/// Note: An implicit member access inside a class, i.e. `a` instead of
275-
/// `this->a`, is an `id-expression`.
276-
class MemberExpression final : public Expression {
277-
public:
278-
MemberExpression() : Expression(NodeKind::MemberExpression) {}
279-
static bool classof(const Node *N);
280-
Expression *getObject();
281-
Leaf *getAccessToken();
282-
Leaf *getTemplateKeyword();
283-
IdExpression *getMember();
284-
};
285-
286159
/// Expression for literals. C++ [lex.literal]
287160
class LiteralExpression : public Expression {
288161
public:

0 commit comments

Comments
 (0)