File tree 3 files changed +17
-1
lines changed
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,7 @@ std::string shortenNamespace(const llvm::StringRef OriginalName,
192
192
193
193
std::string printType (const QualType QT, const DeclContext & Context){
194
194
PrintingPolicy PP (Context.getParentASTContext ().getPrintingPolicy ());
195
+ PP.SuppressUnwrittenScope = 1 ;
195
196
PP.SuppressTagKeyword = 1 ;
196
197
return shortenNamespace (
197
198
QT.getAsString (PP),
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ llvm::Optional<SymbolID> getSymbolID(const IdentifierInfo &II,
67
67
const MacroInfo *MI,
68
68
const SourceManager &SM);
69
69
70
- // / Returns a QualType as string.
70
+ // / Returns a QualType as string. The result doesn't contain unwritten scopes
71
+ // / like annoymous/inline namespace.
71
72
std::string printType (const QualType QT, const DeclContext & Context);
72
73
73
74
// / Try to shorten the OriginalName by removing namespaces from the left of
Original file line number Diff line number Diff line change @@ -663,6 +663,20 @@ TEST(TweakTest, ExpandAutoType) {
663
663
const char * x = "test";
664
664
)cpp" ;
665
665
checkTransform (ID, Input, Output);
666
+
667
+ Input = R"cpp(
668
+ namespace {
669
+ class Foo {};
670
+ }
671
+ au^to f = Foo();
672
+ )cpp" ;
673
+ Output = R"cpp(
674
+ namespace {
675
+ class Foo {};
676
+ }
677
+ Foo f = Foo();
678
+ )cpp" ;
679
+ checkTransform (ID, Input, Output);
666
680
}
667
681
668
682
} // namespace
You can’t perform that action at this time.
0 commit comments