Skip to content

[NameLookup] ASTOOScope ontology #24594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 116 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
663760e
ASTOOScope ontology
Mar 1, 2019
c7a6f80
Clean up
May 28, 2019
173bc09
Only need NameLookup for the ASTScope interface class.
May 28, 2019
3f820c3
Some review tweaks.
May 28, 2019
741a0bf
Typo fix.
May 28, 2019
6942344
Review cleanups.
May 28, 2019
36234c3
function_ref
May 28, 2019
2b9480d
Format
May 28, 2019
8814390
ifndef NDEBUG nify
May 28, 2019
10affe2
Cosmetic fixes.
May 28, 2019
80ccbcf
Simpler trailing angle bracket.
May 29, 2019
5aa5809
Minor cleanups
May 30, 2019
2e7756c
WP Redoing
May 31, 2019
40b0080
WIP createSubtree
May 31, 2019
9035ab8
WIP unfmt
May 31, 2019
11a9ee7
finished creation
davidungar May 31, 2019
2ad2bac
Format
davidungar May 31, 2019
da8ab75
compiling more
davidungar May 31, 2019
e6012a4
fixes
davidungar May 31, 2019
005e259
compiles, unfmt
Jun 1, 2019
23bddf1
Format
Jun 1, 2019
e3d7fc3
Fix
Jun 1, 2019
044f6f8
Fix
Jun 2, 2019
013a45a
Get fileScope sooner for debugging convenience
Jun 2, 2019
d652360
Better pattern printing
Jun 2, 2019
99a36f1
Don’t propagate lastAdopter
Jun 2, 2019
32744e6
fix
Jun 2, 2019
ce50e12
Fix name
Jun 2, 2019
5043d56
Don’t ignore implicit statements.
Jun 2, 2019
501b38d
Fix
Jun 2, 2019
d914ec2
Reverse closure scope args in prep for dup detection
Jun 2, 2019
e86080f
Renamingings
Jun 2, 2019
935587e
Reject dups when deferring.
Jun 2, 2019
ab8b49a
First stab dup detection at the source, unfmt
Jun 2, 2019
8e729aa
Fix
Jun 2, 2019
e48ea31
NDEBUG typo fix
Jun 3, 2019
5b2bf12
Fix debug code.
Jun 3, 2019
91c6de9
Pattern changes
Jun 3, 2019
665a282
Temp debug change
Jun 3, 2019
29f0204
WIP
Jun 4, 2019
ad77af1
Catch top-level dependency for use under pattern.
Jun 4, 2019
5c3bea5
Fixes
Jun 4, 2019
e90a809
Rm bogus
Jun 4, 2019
3f3f51c
new pattern code
Jun 4, 2019
8ff4309
WIP, unfmt
Jun 5, 2019
bae074e
More gross hackery for top-level
Jun 5, 2019
94bd4a8
fmt
Jun 5, 2019
606ce7b
pattern fixes
Jun 5, 2019
e42ee81
Fix assertion
Jun 5, 2019
15cc98c
WIP HERE
Jun 5, 2019
50e599b
Renaming
Jun 5, 2019
1c0da75
Renaming
Jun 5, 2019
dd5d4ab
Rm unused
Jun 5, 2019
73279c9
Upto findLookupParentForUse
Jun 5, 2019
7bc8129
First cut new Guard scheme
Jun 5, 2019
ee6c49c
Create guard use always
Jun 5, 2019
85a5514
Create pattern use always
Jun 5, 2019
f366484
rm finishExpansion
Jun 5, 2019
480807f
Hoisted expand after
Jun 5, 2019
05d38e0
Source range optimization
Jun 5, 2019
fc4cc21
Fixed test
Jun 5, 2019
614f1cd
Fixed test
Jun 5, 2019
15d8a38
Robustness
Jun 5, 2019
670eb61
Spell out GTX
Jun 5, 2019
1e9bc84
Minor cleaning
Jun 5, 2019
13d3c00
Fixes to build release version.
Jun 6, 2019
f997446
fixes
Jun 6, 2019
3b8359c
statement cond bug fix
Jun 6, 2019
3abfa1f
WIP
Jun 8, 2019
253f16b
WIP
Jun 8, 2019
bbd1f76
WIP
Jun 8, 2019
9dd2cae
Share lastAdopter
Jun 8, 2019
2e9f6c0
Formats and fixes
Jun 8, 2019
c0af241
Fix yield expansion
Jun 9, 2019
a724ff1
undo lastAdopter transfer and rename, fix use expansion, rm depth
Jun 9, 2019
d3cf74b
compiles
Jun 9, 2019
2869b4e
Add final’s
Jun 9, 2019
cbed414
Minor renaming
Jun 9, 2019
1d5b9ea
did expandMe
Jun 9, 2019
c4322de
CreateSubtree returns one only
Jun 9, 2019
22d37ec
WIP
Jun 9, 2019
d96896c
compiles, fmt after big deferred redo
Jun 10, 2019
8d526b3
Change insertion point for no-expand nodes
Jun 10, 2019
2e46fe1
Move insertion point
Jun 10, 2019
2baa473
only redo cache at top level
Jun 10, 2019
7d1f024
WIP unfmt
Jun 10, 2019
17bb031
new cond use scheme
Jun 10, 2019
6a8d91f
fmt
Jun 10, 2019
f203509
fixes, unfmted, rm startLocAccordingToCondition
Jun 10, 2019
2b7b7cf
Fix unfmt still rm startLocAccordingToCondition
Jun 10, 2019
edc6a5c
unfmt
Jun 10, 2019
455b344
fmt
Jun 10, 2019
e7cd534
Fixed test
Jun 10, 2019
2b63173
Fixed scope test
Jun 10, 2019
6cdb147
Printing tweaks
Jun 11, 2019
6b6c983
Fix scope test
Jun 11, 2019
2d0a8f2
Passes either way
Jun 11, 2019
6cfcabd
add -disable-parser-lookup
Jun 11, 2019
69f6b41
Use unique_ptr for Scope, getScope returns a reference
Jun 12, 2019
884648d
invariant
Jun 12, 2019
916b217
Outline expandInContext
Jun 12, 2019
21905c1
Rename ASTNode_or_DeclPtr
Jun 12, 2019
9b40b39
Rephrase comment
Jun 12, 2019
55323bb
Typos, etc.
Jun 12, 2019
4122438
Outline lookInGenericsAndSelfType
Jun 12, 2019
b418588
Fix
Jun 12, 2019
16ca723
Explain source ranges
Jun 12, 2019
2f2bbfb
Better method scope lookup
Jun 12, 2019
72b2096
Outer generics
Jun 12, 2019
3e95844
Clean up
Jun 12, 2019
8988fa9
Added fixmes
Jun 12, 2019
6f6a772
implicit checks
Jun 12, 2019
40cd518
Rm doISplitAScope for visitBraceStmt
Jun 12, 2019
44c6248
Rm redundant computeSelfDCForParemt
Jun 13, 2019
50358b2
cosmetic
Jun 13, 2019
320dd89
typo
Jun 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,914 changes: 1,399 additions & 515 deletions include/swift/AST/ASTScope.h

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions include/swift/AST/ExperimentalDependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ template <typename GraphT> class DotFileEmitter {
void emitDotNode(StringRef id, StringRef label, StringRef shape,
StringRef fillColor, StringRef style = StringRef()) {
auto inserted = nodeIDs.insert(id.str());
(void)inserted;
assert(inserted.second && "NodeIDs must be unique.");
out << "\"" << id << "\" [ "
<< "label = \"" << label << "\", "
Expand Down
5 changes: 3 additions & 2 deletions include/swift/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1009,8 +1009,6 @@ class InterpolatedStringLiteralExpr : public LiteralExpr {
return Loc;
}
SourceLoc getTrailingQuoteLoc() const {
// Except when computing a SourceRange for an ASTScope. Then the range
// must be (Start - TrainingQuoteLoc).
return TrailingQuoteLoc;
}

Expand Down Expand Up @@ -4685,6 +4683,9 @@ class EditorPlaceholderExpr : public Expr {
SourceRange getSourceRange() const { return Loc; }
TypeLoc &getTypeLoc() { return PlaceholderTy; }
TypeLoc getTypeLoc() const { return PlaceholderTy; }
SourceLoc getTrailingAngleBracketLoc() const {
return Loc.getAdvancedLoc(Placeholder.getLength() - 1);
}

/// The TypeRepr to be considered for placeholder expansion.
TypeRepr *getTypeForExpansion() const { return ExpansionTyR; }
Expand Down
11 changes: 7 additions & 4 deletions include/swift/AST/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ namespace clang {
namespace swift {
enum class ArtificialMainKind : uint8_t;
class ASTContext;
class ASTScope;
class ASTWalker;
class BraceStmt;
class Decl;
Expand Down Expand Up @@ -80,10 +79,14 @@ namespace swift {
class VarDecl;
class VisibleDeclConsumer;
class SyntaxParsingCache;

namespace syntax {
class ASTScope;

namespace syntax {
class SourceFileSyntax;
}
namespace ast_scope {
class ASTSourceFileScope;
}

/// Discriminator for file-units.
enum class FileUnitKind {
Expand Down Expand Up @@ -989,7 +992,7 @@ class SourceFile final : public FileUnit {
bool HasImplementationOnlyImports = false;

/// The scope map that describes this source file.
ASTScope *Scope = nullptr;
std::unique_ptr<ASTScope> Scope;

friend ASTContext;
friend Impl;
Expand Down
206 changes: 169 additions & 37 deletions include/swift/AST/NameLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "swift/AST/ASTVisitor.h"
#include "swift/AST/Identifier.h"
#include "swift/AST/Module.h"
#include "swift/Basic/Compiler.h"
#include "swift/Basic/NullablePtr.h"
#include "swift/Basic/SourceLoc.h"

namespace swift {
Expand All @@ -36,52 +38,89 @@ namespace swift {
class TypeDecl;
class ValueDecl;
struct SelfBounds;

/// LookupResultEntry - One result of unqualified lookup.
struct LookupResultEntry {
private:

/// The declaration context through which we found Value. For instance,
/// class BaseClass {
/// func foo() {}
/// }
///
/// class DerivedClass : BaseClass {
/// func bar() {}
/// }
///
/// When finding foo() from the body of DerivedClass, BaseDC is DerivedClass.
///
/// Another example:
///
/// class BaseClass {
/// func bar() {}
/// func foo() {}
/// }
///
/// When finding bar() from the function body of foo(), BaseDC is the method
/// foo().
class NominalTypeDecl;

namespace ast_scope {
class ASTSourceFileScope;
class ASTScopeImpl;
} // namespace ast_scope

/// LookupResultEntry - One result of unqualified lookup.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you indenting this out, that just increases the diff without need.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a git-clang-format thing--I'll fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fixed. Let me know if not. I have tried to git-format it all but may have missed something.

struct LookupResultEntry {
private:
/// The declaration context through which we found \c Value. For instance,
/// \code
/// class BaseClass {
/// func foo() {}
/// }
///
/// class DerivedClass : BaseClass {
/// func bar() {}
/// }
/// \endcode
///
/// When finding \c foo() from the body of \c DerivedClass, \c BaseDC is \c
/// DerivedClass.
///
/// Another example:
/// \code
/// class BaseClass {
/// func bar() {}
/// func foo() {}
/// }
/// \endcode
///
/// When finding \c bar() from the function body of \c foo(), \c BaseDC is
/// the method \c foo().
///
/// \c BaseDC will be the method if \c self is needed for the lookup,
/// and will be the type if not.
/// In other words: If \c baseDC is a method, it means you found an instance
/// member and you should add an implicit 'self.' (Each method has its own
/// implicit self decl.) There's one other kind of non-method context that
/// has a 'self.' -- a lazy property initializer, which unlike a non-lazy
/// property can reference \c self) Hence: \code
/// class Outer {
///   static func s()
///   func i()
/// class Inner {
///   static func ss()
///   func ii() {
///   func F() {
///   ii() // OK! implicitly self.ii; BaseDC is the method
///   s()  // OK! s() is defined in an outer type; BaseDC is the type
///   ss() // error: must write /Inner.ss() here since its static
///   i() // error: there's no outer 'self.'
///   }
///   }
/// \endcode
///
/// To sum up: The distinction is whether you need to know the run-time
/// value of \c self. It might be clearer if \code baseDC was always a type,
/// and there was an additional \c ParamDecl field in \c LookupResult which
/// would store the implicit self, if any. \c BaseDC is always one of your
/// outer DCs. if you're inside a type it should never be an extension of
/// that type. And if you're inside an extension it will always be an
/// extension (if it found something at that level).
DeclContext *BaseDC;

/// The declaration corresponds to the given name; i.e. the decl we are
/// looking up.
ValueDecl *Value;

public:
LookupResultEntry(ValueDecl *value) : BaseDC(nullptr), Value(value) { }
LookupResultEntry(ValueDecl *value) : BaseDC(nullptr), Value(value) {}

LookupResultEntry(DeclContext *baseDC, ValueDecl *value)
: BaseDC(baseDC), Value(value) { }
: BaseDC(baseDC), Value(value) {}

ValueDecl *getValueDecl() const {
return Value;
}
ValueDecl *getValueDecl() const { return Value; }

DeclContext *getDeclContext() const {
return BaseDC;
}
DeclContext *getDeclContext() const { return BaseDC; }

ValueDecl *getBaseDecl() const;

void print(llvm::raw_ostream &) const;
};

/// This class implements and represents the result of performing
Expand Down Expand Up @@ -110,13 +149,15 @@ class UnqualifiedLookup {
/// is used to determine which declarations in that body are visible.
UnqualifiedLookup(DeclName Name, DeclContext *DC, LazyResolver *TypeResolver,
SourceLoc Loc = SourceLoc(), Options options = Options());

SmallVector<LookupResultEntry, 4> Results;

using ResultsVector = SmallVector<LookupResultEntry, 4>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using this type outside of the class? If not, why create this? If you are using it outside, it is better to use SmallVectorImpl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, UnqualifedLookupFactory uses it, and no, the Impl type won't do. But is there a better way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wont it do. If you are passing it to someone, you can use SmallVectorImpl< LookupResultEntry> &

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In unqualifiedLookup.cpp:

  if (compareToASTScopes && useASTScopesForExperimentalLookupIfEnabled()) {
    ResultsVector results;
    size_t indexOfFirstOuterResult = 0;
    UnqualifiedLookupFactory scopeLookup(Name, DC, TypeResolver, Loc, options,
                                         results, indexOfFirstOuterResult);

The code needs to create a results vector, so it can make another factory for comparison purposes. Publishing the type seemed like the clearest way. I suppose the code could use a decltype instead but it's not clearer.

ResultsVector Results;

/// The index of the first result that isn't from the innermost scope
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put a newline line here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good catch, thanks!

/// with results.
///
/// That is, \c makeArrayRef(Results).take_front(IndexOfFirstOuterResults)
/// will be Results from the innermost scope that had results, and the
/// will be \c Results from the innermost scope that had results, and the
/// remaining elements of Results will be from parent scopes of this one.
///
/// Allows unqualified name lookup to return results from outer scopes.
Expand All @@ -136,7 +177,6 @@ inline UnqualifiedLookup::Options operator|(UnqualifiedLookup::Flags flag1,
return UnqualifiedLookup::Options(flag1) | flag2;
}


/// Describes the reason why a certain declaration is visible.
enum class DeclVisibilityKind {
/// Declaration is a local variable or type.
Expand Down Expand Up @@ -536,8 +576,100 @@ class FindLocalVal : public StmtVisitor<FindLocalVal> {
void visitCatchStmt(CatchStmt *S);

};


/// The bridge between the legacy UnqualifedLookupFactory and the new ASTScope
/// lookup system
class AbstractASTScopeDeclConsumer {
public:
AbstractASTScopeDeclConsumer() {}

virtual ~AbstractASTScopeDeclConsumer() = default;

/// Called for every ValueDecl visible from the lookup.
/// Returns true if the lookup can be stopped at this point.
/// BaseDC is per legacy
/// Takes an array in order to batch the consumption before setting
/// IndexOfFirstOuterResult when necessary.
virtual bool consume(ArrayRef<ValueDecl *> values, DeclVisibilityKind vis,
Optional<bool> isCascadingUse,
NullablePtr<DeclContext> baseDC = nullptr) = 0;

/// Eventually this functionality should move into ASTScopeLookup
virtual std::pair<bool, Optional<bool>>
lookupInSelfType(NullablePtr<DeclContext> selfDC, DeclContext *const scopeDC,
NominalTypeDecl *const nominal,
Optional<bool> isCascadingUse) = 0;

#ifndef NDEBUG
virtual void stopForDebuggingIfTargetLookup() = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this going to be called in the code always? If this is only for debugging the compiler, it should be hidden behind an #ifdef.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Will do.

#endif
};

/// Just used to print
/// Used to gather lookup results
class ASTScopeDeclGatherer : public AbstractASTScopeDeclConsumer {
SmallVector<ValueDecl *, 32> values;

public:
virtual ~ASTScopeDeclGatherer() = default;

bool consume(ArrayRef<ValueDecl *> values, DeclVisibilityKind vis,
Optional<bool> isCascadingUse,
NullablePtr<DeclContext> baseDC = nullptr) override;

/// Eventually this functionality should move into ASTScopeLookup
std::pair<bool, Optional<bool>>
lookupInSelfType(NullablePtr<DeclContext>, DeclContext *const,
NominalTypeDecl *const,
Optional<bool> isCascadingUse) override {
return std::make_pair(false, isCascadingUse);
}

#ifndef NDEBUG
void stopForDebuggingIfTargetLookup() override {}
#endif

ArrayRef<ValueDecl *> getDecls() { return values; }
};
} // end namespace namelookup

/// The interface into the ASTScope subsystem
class ASTScope {
friend class ast_scope::ASTScopeImpl;
ast_scope::ASTSourceFileScope *const impl;

public:
ASTScope(SourceFile *);
static Optional<bool>
unqualifiedLookup(SourceFile *, DeclName, SourceLoc,
const DeclContext *startingContext,
Optional<bool> isCascadingUse,
namelookup::AbstractASTScopeDeclConsumer &);

LLVM_ATTRIBUTE_DEPRECATED(void dump() const LLVM_ATTRIBUTE_USED,
"only for use within the debugger");
void print(llvm::raw_ostream &) const;
void dumpOneScopeMapLocation(std::pair<unsigned, unsigned>) const;

// Make vanilla new illegal for ASTScopes.
void *operator new(size_t bytes) = delete;
// Need this because have virtual destructors
void operator delete(void *data) {}

// Only allow allocation of scopes using the allocator of a particular source
// file.
void *operator new(size_t bytes, const ASTContext &ctx,
unsigned alignment = alignof(ASTScope));
void *operator new(size_t Bytes, void *Mem) {
assert(Mem);
return Mem;
}

private:
static ast_scope::ASTSourceFileScope *createScopeTree(SourceFile *);
};

} // end namespace swift

#endif
6 changes: 6 additions & 0 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ namespace swift {

/// Should we use \c ASTScope-based resolution for unqualified name lookup?
bool EnableASTScopeLookup = false;

/// Someday, ASTScopeLookup will supplant lookup in the parser
bool DisableParserLookup = false;

/// Sound we compare to ASTScope-based resolution for debugging?
bool CompareToASTScopeLookup = false;

/// Whether to use the import as member inference system
///
Expand Down
7 changes: 7 additions & 0 deletions include/swift/Basic/STLExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,13 @@ class RelationalOperationsBase {
return !(left == right);
}
};

/// Cast a pointer to \c U to a pointer to a supertype \c T.
/// Example: Wobulator *w = up_cast<Wobulator>(coloredWobulator)
/// Useful with ?: where each arm is a different subtype.
/// If \c U is not a subtype of \c T, the compiler will complain.
template <typename T, typename U>
T *up_cast(U *ptr) { return ptr; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We follow camelCase for functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But up_cast is consistent with dyn_cast, etc.


/// Removes all runs of values that match \p pred from the range of \p begin
/// to \p end.
Expand Down
6 changes: 3 additions & 3 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ def enable_target_os_checking :
def disable_target_os_checking :
Flag<["-"], "disable-target-os-checking">,
HelpText<"Disable checking the target OS of serialized modules">;

def enable_astscope_lookup : Flag<["-"], "enable-astscope-lookup">,
HelpText<"Enable ASTScope-based unqualified name lookup">;
def compare_to_astscope_lookup : Flag<["-"], "compare-to-astscope-lookup">,
HelpText<"Compare legacy to ASTScope-based unqualified name lookup (for debugging)">;

def print_clang_stats : Flag<["-"], "print-clang-stats">,
HelpText<"Print Clang importer statistics">;
Expand Down
7 changes: 7 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,13 @@ def sanitize_coverage_EQ : CommaJoined<["-"], "sanitize-coverage=">,
HelpText<"Specify the type of coverage instrumentation for Sanitizers and"
" additional options separated by commas">;

def enable_astscope_lookup : Flag<["-"], "enable-astscope-lookup">,
Flags<[FrontendOption]>,
HelpText<"Enable ASTScope-based unqualified name lookup">;

def disable_parser_lookup : Flag<["-"], "disable_parser_lookup">,
HelpText<"Disable parser lookup & use ast scope lookup only (experimental)">;

def index_file : Flag<["-"], "index-file">,
HelpText<"Produce index data for a source file">, ModeOpt,
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
Expand Down
6 changes: 3 additions & 3 deletions include/swift/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,15 +714,15 @@ class Parser {

/// Add the given Decl to the current scope.
void addToScope(ValueDecl *D, bool diagnoseRedefinitions = true) {
if (Context.LangOpts.EnableASTScopeLookup)
if (Context.LangOpts.DisableParserLookup)
return;

getScopeInfo().addToScope(D, *this, diagnoseRedefinitions);
}

ValueDecl *lookupInScope(DeclName Name) {
if (Context.LangOpts.EnableASTScopeLookup)
return nullptr;
if (Context.LangOpts.DisableParserLookup)
return nullptr;

return getScopeInfo().lookupValueName(Name);
}
Expand Down
Loading