Skip to content

Commit 15e76ee

Browse files
committed
[clang] Add [is|set]Nested methods to NamespaceDecl
Adds support for NamespaceDecl to inform if its part of a nested namespace. This flag only corresponds to the inner namespaces in a nested namespace declaration. In this example: namespace <X>::<Y>::<Z> {} Only <Y> and <Z> will be classified as nested. This flag isn't meant for assisting in building the AST, more for static analysis and refactorings. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D90568
1 parent 3467f9c commit 15e76ee

16 files changed

+111
-54
lines changed

clang/include/clang/AST/Decl.h

+35-10
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ class LabelDecl : public NamedDecl {
542542
class NamespaceDecl : public NamedDecl, public DeclContext,
543543
public Redeclarable<NamespaceDecl>
544544
{
545+
546+
enum Flags : unsigned { F_Inline = 1 << 0, F_Nested = 1 << 1 };
547+
545548
/// The starting location of the source range, pointing
546549
/// to either the namespace or the inline keyword.
547550
SourceLocation LocStart;
@@ -553,11 +556,12 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
553556
/// this namespace or to the first namespace in the chain (the latter case
554557
/// only when this is not the first in the chain), along with a
555558
/// boolean value indicating whether this is an inline namespace.
556-
llvm::PointerIntPair<NamespaceDecl *, 1, bool> AnonOrFirstNamespaceAndInline;
559+
llvm::PointerIntPair<NamespaceDecl *, 2, unsigned>
560+
AnonOrFirstNamespaceAndFlags;
557561

558562
NamespaceDecl(ASTContext &C, DeclContext *DC, bool Inline,
559563
SourceLocation StartLoc, SourceLocation IdLoc,
560-
IdentifierInfo *Id, NamespaceDecl *PrevDecl);
564+
IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested);
561565

562566
using redeclarable_base = Redeclarable<NamespaceDecl>;
563567

@@ -569,10 +573,10 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
569573
friend class ASTDeclReader;
570574
friend class ASTDeclWriter;
571575

572-
static NamespaceDecl *Create(ASTContext &C, DeclContext *DC,
573-
bool Inline, SourceLocation StartLoc,
574-
SourceLocation IdLoc, IdentifierInfo *Id,
575-
NamespaceDecl *PrevDecl);
576+
static NamespaceDecl *Create(ASTContext &C, DeclContext *DC, bool Inline,
577+
SourceLocation StartLoc, SourceLocation IdLoc,
578+
IdentifierInfo *Id, NamespaceDecl *PrevDecl,
579+
bool Nested);
576580

577581
static NamespaceDecl *CreateDeserialized(ASTContext &C, unsigned ID);
578582

@@ -601,12 +605,33 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
601605

602606
/// Returns true if this is an inline namespace declaration.
603607
bool isInline() const {
604-
return AnonOrFirstNamespaceAndInline.getInt();
608+
return AnonOrFirstNamespaceAndFlags.getInt() & F_Inline;
605609
}
606610

607611
/// Set whether this is an inline namespace declaration.
608612
void setInline(bool Inline) {
609-
AnonOrFirstNamespaceAndInline.setInt(Inline);
613+
unsigned F = AnonOrFirstNamespaceAndFlags.getInt();
614+
if (Inline)
615+
AnonOrFirstNamespaceAndFlags.setInt(F | F_Inline);
616+
else
617+
AnonOrFirstNamespaceAndFlags.setInt(F & ~F_Inline);
618+
}
619+
620+
/// Returns true if this is a nested namespace declaration.
621+
/// \code
622+
/// namespace outer::nested { }
623+
/// \endcode
624+
bool isNested() const {
625+
return AnonOrFirstNamespaceAndFlags.getInt() & F_Nested;
626+
}
627+
628+
/// Set whether this is a nested namespace declaration.
629+
void setNested(bool Nested) {
630+
unsigned F = AnonOrFirstNamespaceAndFlags.getInt();
631+
if (Nested)
632+
AnonOrFirstNamespaceAndFlags.setInt(F | F_Nested);
633+
else
634+
AnonOrFirstNamespaceAndFlags.setInt(F & ~F_Nested);
610635
}
611636

612637
/// Returns true if the inline qualifier for \c Name is redundant.
@@ -635,11 +660,11 @@ class NamespaceDecl : public NamedDecl, public DeclContext,
635660
/// Retrieve the anonymous namespace nested inside this namespace,
636661
/// if any.
637662
NamespaceDecl *getAnonymousNamespace() const {
638-
return getOriginalNamespace()->AnonOrFirstNamespaceAndInline.getPointer();
663+
return getOriginalNamespace()->AnonOrFirstNamespaceAndFlags.getPointer();
639664
}
640665

641666
void setAnonymousNamespace(NamespaceDecl *D) {
642-
getOriginalNamespace()->AnonOrFirstNamespaceAndInline.setPointer(D);
667+
getOriginalNamespace()->AnonOrFirstNamespaceAndFlags.setPointer(D);
643668
}
644669

645670
/// Retrieves the canonical declaration of this namespace.

clang/include/clang/Sema/Sema.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6041,7 +6041,7 @@ class Sema final {
60416041
SourceLocation IdentLoc, IdentifierInfo *Ident,
60426042
SourceLocation LBrace,
60436043
const ParsedAttributesView &AttrList,
6044-
UsingDirectiveDecl *&UsingDecl);
6044+
UsingDirectiveDecl *&UsingDecl, bool IsNested);
60456045
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
60466046

60476047
NamespaceDecl *getStdNamespace() const;

clang/lib/AST/ASTContext.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -8765,9 +8765,9 @@ CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context) {
87658765
// namespace std { struct __va_list {
87668766
auto *NS = NamespaceDecl::Create(
87678767
const_cast<ASTContext &>(*Context), Context->getTranslationUnitDecl(),
8768-
/*Inline*/ false, SourceLocation(), SourceLocation(),
8768+
/*Inline=*/false, SourceLocation(), SourceLocation(),
87698769
&Context->Idents.get("std"),
8770-
/*PrevDecl*/ nullptr);
8770+
/*PrevDecl=*/nullptr, /*Nested=*/false);
87718771
NS->setImplicit();
87728772
VaListTagDecl->setDeclContext(NS);
87738773
}
@@ -8954,9 +8954,9 @@ CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context) {
89548954
NamespaceDecl *NS;
89558955
NS = NamespaceDecl::Create(const_cast<ASTContext &>(*Context),
89568956
Context->getTranslationUnitDecl(),
8957-
/*Inline*/false, SourceLocation(),
8957+
/*Inline=*/false, SourceLocation(),
89588958
SourceLocation(), &Context->Idents.get("std"),
8959-
/*PrevDecl*/ nullptr);
8959+
/*PrevDecl=*/nullptr, /*Nested=*/false);
89608960
NS->setImplicit();
89618961
VaListDecl->setDeclContext(NS);
89628962
}

clang/lib/AST/ASTImporter.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -2412,10 +2412,10 @@ ExpectedDecl ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) {
24122412
// Create the "to" namespace, if needed.
24132413
NamespaceDecl *ToNamespace = MergeWithNamespace;
24142414
if (!ToNamespace) {
2415-
if (GetImportedOrCreateDecl(
2416-
ToNamespace, D, Importer.getToContext(), DC, D->isInline(),
2417-
*BeginLocOrErr, Loc, Name.getAsIdentifierInfo(),
2418-
/*PrevDecl=*/nullptr))
2415+
if (GetImportedOrCreateDecl(ToNamespace, D, Importer.getToContext(), DC,
2416+
D->isInline(), *BeginLocOrErr, Loc,
2417+
Name.getAsIdentifierInfo(),
2418+
/*PrevDecl=*/nullptr, D->isNested()))
24192419
return ToNamespace;
24202420
ToNamespace->setRBraceLoc(*RBraceLocOrErr);
24212421
ToNamespace->setLexicalDeclContext(LexicalDC);

clang/lib/AST/DeclCXX.cpp

+16-10
Original file line numberDiff line numberDiff line change
@@ -2880,41 +2880,47 @@ NamespaceDecl *UsingDirectiveDecl::getNominatedNamespace() {
28802880

28812881
NamespaceDecl::NamespaceDecl(ASTContext &C, DeclContext *DC, bool Inline,
28822882
SourceLocation StartLoc, SourceLocation IdLoc,
2883-
IdentifierInfo *Id, NamespaceDecl *PrevDecl)
2883+
IdentifierInfo *Id, NamespaceDecl *PrevDecl,
2884+
bool Nested)
28842885
: NamedDecl(Namespace, DC, IdLoc, Id), DeclContext(Namespace),
2885-
redeclarable_base(C), LocStart(StartLoc),
2886-
AnonOrFirstNamespaceAndInline(nullptr, Inline) {
2886+
redeclarable_base(C), LocStart(StartLoc) {
2887+
unsigned Flags = 0;
2888+
if (Inline)
2889+
Flags |= F_Inline;
2890+
if (Nested)
2891+
Flags |= F_Nested;
2892+
AnonOrFirstNamespaceAndFlags = {nullptr, Flags};
28872893
setPreviousDecl(PrevDecl);
28882894

28892895
if (PrevDecl)
2890-
AnonOrFirstNamespaceAndInline.setPointer(PrevDecl->getOriginalNamespace());
2896+
AnonOrFirstNamespaceAndFlags.setPointer(PrevDecl->getOriginalNamespace());
28912897
}
28922898

28932899
NamespaceDecl *NamespaceDecl::Create(ASTContext &C, DeclContext *DC,
28942900
bool Inline, SourceLocation StartLoc,
28952901
SourceLocation IdLoc, IdentifierInfo *Id,
2896-
NamespaceDecl *PrevDecl) {
2897-
return new (C, DC) NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id,
2898-
PrevDecl);
2902+
NamespaceDecl *PrevDecl, bool Nested) {
2903+
return new (C, DC)
2904+
NamespaceDecl(C, DC, Inline, StartLoc, IdLoc, Id, PrevDecl, Nested);
28992905
}
29002906

29012907
NamespaceDecl *NamespaceDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
29022908
return new (C, ID) NamespaceDecl(C, nullptr, false, SourceLocation(),
2903-
SourceLocation(), nullptr, nullptr);
2909+
SourceLocation(), nullptr, nullptr, false);
29042910
}
29052911

29062912
NamespaceDecl *NamespaceDecl::getOriginalNamespace() {
29072913
if (isFirstDecl())
29082914
return this;
29092915

2910-
return AnonOrFirstNamespaceAndInline.getPointer();
2916+
return AnonOrFirstNamespaceAndFlags.getPointer();
29112917
}
29122918

29132919
const NamespaceDecl *NamespaceDecl::getOriginalNamespace() const {
29142920
if (isFirstDecl())
29152921
return this;
29162922

2917-
return AnonOrFirstNamespaceAndInline.getPointer();
2923+
return AnonOrFirstNamespaceAndFlags.getPointer();
29182924
}
29192925

29202926
bool NamespaceDecl::isOriginalNamespace() const { return isFirstDecl(); }

clang/lib/AST/ItaniumMangle.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,9 @@ NamespaceDecl *ItaniumMangleContextImpl::getStdNamespace() {
602602
if (!StdNamespace) {
603603
StdNamespace = NamespaceDecl::Create(
604604
getASTContext(), getASTContext().getTranslationUnitDecl(),
605-
/*Inline*/ false, SourceLocation(), SourceLocation(),
605+
/*Inline=*/false, SourceLocation(), SourceLocation(),
606606
&getASTContext().Idents.get("std"),
607-
/*PrevDecl*/ nullptr);
607+
/*PrevDecl=*/nullptr, /*Nested=*/false);
608608
StdNamespace->setImplicit();
609609
}
610610
return StdNamespace;

clang/lib/AST/JSONNodeDumper.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ void JSONNodeDumper::VisitTypeAliasDecl(const TypeAliasDecl *TAD) {
794794
void JSONNodeDumper::VisitNamespaceDecl(const NamespaceDecl *ND) {
795795
VisitNamedDecl(ND);
796796
attributeOnlyIfTrue("isInline", ND->isInline());
797+
attributeOnlyIfTrue("isNested", ND->isNested());
797798
if (!ND->isOriginalNamespace())
798799
JOS.attribute("originalNamespace",
799800
createBareDeclRef(ND->getOriginalNamespace()));

clang/lib/AST/TextNodeDumper.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,8 @@ void TextNodeDumper::VisitNamespaceDecl(const NamespaceDecl *D) {
19311931
dumpName(D);
19321932
if (D->isInline())
19331933
OS << " inline";
1934+
if (D->isNested())
1935+
OS << " nested";
19341936
if (!D->isOriginalNamespace())
19351937
dumpDeclRef(D->getOriginalNamespace(), "original");
19361938
}

clang/lib/Parse/ParseDeclCXX.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Parser::DeclGroupPtrTy Parser::ParseNamespace(DeclaratorContext Context,
227227
UsingDirectiveDecl *ImplicitUsingDirectiveDecl = nullptr;
228228
Decl *NamespcDecl = Actions.ActOnStartNamespaceDef(
229229
getCurScope(), InlineLoc, NamespaceLoc, IdentLoc, Ident,
230-
T.getOpenLocation(), attrs, ImplicitUsingDirectiveDecl);
230+
T.getOpenLocation(), attrs, ImplicitUsingDirectiveDecl, false);
231231

232232
PrettyDeclStackTraceEntry CrashInfo(Actions.Context, NamespcDecl,
233233
NamespaceLoc, "parsing namespace");
@@ -275,7 +275,7 @@ void Parser::ParseInnerNamespace(const InnerNamespaceInfoList &InnerNSs,
275275
Decl *NamespcDecl = Actions.ActOnStartNamespaceDef(
276276
getCurScope(), InnerNSs[index].InlineLoc, InnerNSs[index].NamespaceLoc,
277277
InnerNSs[index].IdentLoc, InnerNSs[index].Ident,
278-
Tracker.getOpenLocation(), attrs, ImplicitUsingDirectiveDecl);
278+
Tracker.getOpenLocation(), attrs, ImplicitUsingDirectiveDecl, true);
279279
assert(!ImplicitUsingDirectiveDecl &&
280280
"nested namespace definition cannot define anonymous namespace");
281281

clang/lib/Sema/HLSLExternalSemaSource.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ void HLSLExternalSemaSource::InitializeSema(Sema &S) {
385385
NamespaceDecl *PrevDecl = nullptr;
386386
if (S.LookupQualifiedName(Result, AST.getTranslationUnitDecl()))
387387
PrevDecl = Result.getAsSingle<NamespaceDecl>();
388-
HLSLNamespace = NamespaceDecl::Create(AST, AST.getTranslationUnitDecl(),
389-
false, SourceLocation(),
390-
SourceLocation(), &HLSL, PrevDecl);
388+
HLSLNamespace = NamespaceDecl::Create(
389+
AST, AST.getTranslationUnitDecl(), /*Inline=*/false, SourceLocation(),
390+
SourceLocation(), &HLSL, PrevDecl, /*Nested=*/false);
391391
HLSLNamespace->setImplicit(true);
392392
HLSLNamespace->setHasExternalLexicalStorage();
393393
AST.getTranslationUnitDecl()->addDecl(HLSLNamespace);

clang/lib/Sema/SemaDeclCXX.cpp

+14-12
Original file line numberDiff line numberDiff line change
@@ -11171,10 +11171,13 @@ static void DiagnoseNamespaceInlineMismatch(Sema &S, SourceLocation KeywordLoc,
1117111171

1117211172
/// ActOnStartNamespaceDef - This is called at the start of a namespace
1117311173
/// definition.
11174-
Decl *Sema::ActOnStartNamespaceDef(
11175-
Scope *NamespcScope, SourceLocation InlineLoc, SourceLocation NamespaceLoc,
11176-
SourceLocation IdentLoc, IdentifierInfo *II, SourceLocation LBrace,
11177-
const ParsedAttributesView &AttrList, UsingDirectiveDecl *&UD) {
11174+
Decl *Sema::ActOnStartNamespaceDef(Scope *NamespcScope,
11175+
SourceLocation InlineLoc,
11176+
SourceLocation NamespaceLoc,
11177+
SourceLocation IdentLoc, IdentifierInfo *II,
11178+
SourceLocation LBrace,
11179+
const ParsedAttributesView &AttrList,
11180+
UsingDirectiveDecl *&UD, bool IsNested) {
1117811181
SourceLocation StartLoc = InlineLoc.isValid() ? InlineLoc : NamespaceLoc;
1117911182
// For anonymous namespace, take the location of the left brace.
1118011183
SourceLocation Loc = II ? IdentLoc : LBrace;
@@ -11244,8 +11247,8 @@ Decl *Sema::ActOnStartNamespaceDef(
1124411247
&IsInline, PrevNS);
1124511248
}
1124611249

11247-
NamespaceDecl *Namespc = NamespaceDecl::Create(Context, CurContext, IsInline,
11248-
StartLoc, Loc, II, PrevNS);
11250+
NamespaceDecl *Namespc = NamespaceDecl::Create(
11251+
Context, CurContext, IsInline, StartLoc, Loc, II, PrevNS, IsNested);
1124911252
if (IsInvalid)
1125011253
Namespc->setInvalidDecl();
1125111254

@@ -11506,12 +11509,11 @@ QualType Sema::CheckComparisonCategoryType(ComparisonCategoryType Kind,
1150611509
NamespaceDecl *Sema::getOrCreateStdNamespace() {
1150711510
if (!StdNamespace) {
1150811511
// The "std" namespace has not yet been defined, so build one implicitly.
11509-
StdNamespace = NamespaceDecl::Create(Context,
11510-
Context.getTranslationUnitDecl(),
11511-
/*Inline=*/false,
11512-
SourceLocation(), SourceLocation(),
11513-
&PP.getIdentifierTable().get("std"),
11514-
/*PrevDecl=*/nullptr);
11512+
StdNamespace = NamespaceDecl::Create(
11513+
Context, Context.getTranslationUnitDecl(),
11514+
/*Inline=*/false, SourceLocation(), SourceLocation(),
11515+
&PP.getIdentifierTable().get("std"),
11516+
/*PrevDecl=*/nullptr, /*Nested=*/false);
1151511517
getStdNamespace()->setImplicit(true);
1151611518
}
1151711519

clang/lib/Serialization/ASTReaderDecl.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,7 @@ void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
17451745
RedeclarableResult Redecl = VisitRedeclarable(D);
17461746
VisitNamedDecl(D);
17471747
D->setInline(Record.readInt());
1748+
D->setNested(Record.readInt());
17481749
D->LocStart = readSourceLocation();
17491750
D->RBraceLoc = readSourceLocation();
17501751

@@ -1758,7 +1759,7 @@ void ASTDeclReader::VisitNamespaceDecl(NamespaceDecl *D) {
17581759
} else {
17591760
// Link this namespace back to the first declaration, which has already
17601761
// been deserialized.
1761-
D->AnonOrFirstNamespaceAndInline.setPointer(D->getFirstDecl());
1762+
D->AnonOrFirstNamespaceAndFlags.setPointer(D->getFirstDecl());
17621763
}
17631764

17641765
mergeRedeclarable(D, Redecl);
@@ -2784,8 +2785,8 @@ void ASTDeclReader::mergeRedeclarable(Redeclarable<T> *DBase, T *Existing,
27842785
// We cannot have loaded any redeclarations of this declaration yet, so
27852786
// there's nothing else that needs to be updated.
27862787
if (auto *Namespace = dyn_cast<NamespaceDecl>(D))
2787-
Namespace->AnonOrFirstNamespaceAndInline.setPointer(
2788-
assert_cast<NamespaceDecl*>(ExistingCanon));
2788+
Namespace->AnonOrFirstNamespaceAndFlags.setPointer(
2789+
assert_cast<NamespaceDecl *>(ExistingCanon));
27892790

27902791
// When we merge a template, merge its pattern.
27912792
if (auto *DTemplate = dyn_cast<RedeclarableTemplateDecl>(D))

clang/lib/Serialization/ASTWriterDecl.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,7 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
12521252
VisitRedeclarable(D);
12531253
VisitNamedDecl(D);
12541254
Record.push_back(D->isInline());
1255+
Record.push_back(D->isNested());
12551256
Record.AddSourceLocation(D->getBeginLoc());
12561257
Record.AddSourceLocation(D->getRBraceLoc());
12571258

clang/test/AST/ast-dump-decl.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ inline namespace TestNamespaceDeclInline {
5353
}
5454
// CHECK: NamespaceDecl{{.*}} TestNamespaceDeclInline inline
5555

56+
namespace TestNestedNameSpace::Nested {
57+
}
58+
// CHECK: NamespaceDecl{{.*}} TestNestedNameSpace
59+
// CHECK: NamespaceDecl{{.*}} Nested nested{{\s*$}}
60+
61+
namespace TestMultipleNested::SecondLevelNested::Nested {
62+
}
63+
// CHECK: NamespaceDecl{{.*}} TestMultipleNested
64+
// CHECK: NamespaceDecl{{.*}} SecondLevelNested nested
65+
// CHECK: NamespaceDecl{{.*}} Nested nested{{\s*$}}
66+
67+
namespace TestInlineNested::inline SecondLevel::inline Nested {
68+
}
69+
// CHECK: NamespaceDecl{{.*}} TestInlineNested
70+
// CHECK: NamespaceDecl{{.*}} SecondLevel inline nested
71+
// CHECK: NamespaceDecl{{.*}} Nested inline nested{{\s*$}}
72+
5673
namespace testUsingDirectiveDecl {
5774
namespace A {
5875
}

clang/test/AST/ast-dump-namespace-json.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ namespace quux::inline frobble {
170170
// CHECK-NEXT: }
171171
// CHECK-NEXT: },
172172
// CHECK-NEXT: "name": "quux"
173+
// CHECK-NEXT: "isNested": true
173174
// CHECK-NEXT: }
174175
// CHECK-NEXT: ]
175176
// CHECK-NEXT: }
@@ -195,7 +196,7 @@ namespace quux::inline frobble {
195196
// CHECK-NEXT: "tokLen": 1
196197
// CHECK-NEXT: }
197198
// CHECK-NEXT: },
198-
// CHECK-NEXT: "name": "quux",
199+
// CHECK-NEXT: "name": "quux"
199200
// CHECK-NEXT: "inner": [
200201
// CHECK-NEXT: {
201202
// CHECK-NEXT: "id": "0x{{.*}}",
@@ -220,7 +221,8 @@ namespace quux::inline frobble {
220221
// CHECK-NEXT: }
221222
// CHECK-NEXT: },
222223
// CHECK-NEXT: "name": "frobble",
223-
// CHECK-NEXT: "isInline": true
224+
// CHECK-NEXT: "isInline": true,
225+
// CHECK-NEXT: "isNested": true
224226
// CHECK-NEXT: }
225227
// CHECK-NEXT: ]
226228
// CHECK-NEXT: }

clang/unittests/Sema/ExternalSemaSourceTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class NamespaceTypoProvider : public clang::ExternalSemaSource {
121121
CurrentSema->getPreprocessor().getIdentifierInfo(CorrectTo);
122122
NamespaceDecl *NewNamespace =
123123
NamespaceDecl::Create(Context, DestContext, false, Typo.getBeginLoc(),
124-
Typo.getLoc(), ToIdent, nullptr);
124+
Typo.getLoc(), ToIdent, nullptr, false);
125125
DestContext->addDecl(NewNamespace);
126126
TypoCorrection Correction(ToIdent);
127127
Correction.addCorrectionDecl(NewNamespace);

0 commit comments

Comments
 (0)