diff options
Diffstat (limited to 'include/clang/Sema/Lookup.h')
| -rw-r--r-- | include/clang/Sema/Lookup.h | 25 | 
1 files changed, 22 insertions, 3 deletions
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h index ea32997d40667..546df8842a356 100644 --- a/include/clang/Sema/Lookup.h +++ b/include/clang/Sema/Lookup.h @@ -139,6 +139,7 @@ public:        LookupKind(LookupKind),        IDNS(0),        Redecl(Redecl != Sema::NotForRedeclaration), +      ExternalRedecl(Redecl == Sema::ForExternalRedeclaration),        HideTags(true),        Diagnose(Redecl == Sema::NotForRedeclaration),        AllowHidden(false), @@ -161,6 +162,7 @@ public:        LookupKind(LookupKind),        IDNS(0),        Redecl(Redecl != Sema::NotForRedeclaration), +      ExternalRedecl(Redecl == Sema::ForExternalRedeclaration),        HideTags(true),        Diagnose(Redecl == Sema::NotForRedeclaration),        AllowHidden(false), @@ -181,6 +183,7 @@ public:        LookupKind(Other.LookupKind),        IDNS(Other.IDNS),        Redecl(Other.Redecl), +      ExternalRedecl(Other.ExternalRedecl),        HideTags(Other.HideTags),        Diagnose(false),        AllowHidden(Other.AllowHidden), @@ -201,7 +204,9 @@ public:          SemaPtr(std::move(Other.SemaPtr)), NameInfo(std::move(Other.NameInfo)),          NameContextRange(std::move(Other.NameContextRange)),          LookupKind(std::move(Other.LookupKind)), IDNS(std::move(Other.IDNS)), -        Redecl(std::move(Other.Redecl)), HideTags(std::move(Other.HideTags)), +        Redecl(std::move(Other.Redecl)), +        ExternalRedecl(std::move(Other.ExternalRedecl)), +        HideTags(std::move(Other.HideTags)),          Diagnose(std::move(Other.Diagnose)),          AllowHidden(std::move(Other.AllowHidden)),          Shadowed(std::move(Other.Shadowed)) { @@ -221,6 +226,7 @@ public:      LookupKind = std::move(Other.LookupKind);      IDNS = std::move(Other.IDNS);      Redecl = std::move(Other.Redecl); +    ExternalRedecl = std::move(Other.ExternalRedecl);      HideTags = std::move(Other.HideTags);      Diagnose = std::move(Other.Diagnose);      AllowHidden = std::move(Other.AllowHidden); @@ -265,6 +271,17 @@ public:      return Redecl;    } +  /// True if this lookup is just looking for an existing declaration to link +  /// against a declaration with external linkage. +  bool isForExternalRedeclaration() const { +    return ExternalRedecl; +  } + +  Sema::RedeclarationKind redeclarationKind() const { +    return ExternalRedecl ? Sema::ForExternalRedeclaration : +           Redecl ? Sema::ForVisibleRedeclaration : Sema::NotForRedeclaration; +  } +    /// \brief Specify whether hidden declarations are visible, e.g.,    /// for recovery reasons.    void setAllowHidden(bool AH) { @@ -275,7 +292,7 @@ public:    /// declarations, such as those in modules that have not yet been imported.    bool isHiddenDeclarationVisible(NamedDecl *ND) const {      return AllowHidden || -           (isForRedeclaration() && ND->hasExternalFormalLinkage()); +           (isForExternalRedeclaration() && ND->isExternallyDeclarable());    }    /// Sets whether tag declarations should be hidden by non-tag @@ -556,7 +573,8 @@ public:    /// \brief Change this lookup's redeclaration kind.    void setRedeclarationKind(Sema::RedeclarationKind RK) { -    Redecl = RK; +    Redecl = (RK != Sema::NotForRedeclaration); +    ExternalRedecl = (RK == Sema::ForExternalRedeclaration);      configure();    } @@ -719,6 +737,7 @@ private:    unsigned IDNS; // set by configure()    bool Redecl; +  bool ExternalRedecl;    /// \brief True if tag declarations should be hidden if non-tags    ///   are present  | 
