summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/Decl.h3
-rw-r--r--clang/include/clang/AST/Type.h4
-rw-r--r--clang/lib/AST/Type.cpp3
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp7
4 files changed, 8 insertions, 9 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index 443ac2782af..f854118d04e 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -2693,8 +2693,7 @@ public:
IsCompleteDefinitionRequired = V;
}
- // FIXME: Return StringRef;
- const char *getKindName() const {
+ StringRef getKindName() const {
return TypeWithKeyword::getTagTypeKindName(getTagKind());
}
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 001a87ec283..45a0c2e689b 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -3980,9 +3980,9 @@ public:
static bool KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword);
- static const char *getKeywordName(ElaboratedTypeKeyword Keyword);
+ static StringRef getKeywordName(ElaboratedTypeKeyword Keyword);
- static const char *getTagTypeKindName(TagTypeKind Kind) {
+ static StringRef getTagTypeKindName(TagTypeKind Kind) {
return getKeywordName(getKeywordForTagTypeKind(Kind));
}
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index dc3fcc8c78b..e9002b4e873 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -1431,8 +1431,7 @@ TypeWithKeyword::KeywordIsTagTypeKind(ElaboratedTypeKeyword Keyword) {
llvm_unreachable("Unknown elaborated type keyword.");
}
-const char*
-TypeWithKeyword::getKeywordName(ElaboratedTypeKeyword Keyword) {
+StringRef TypeWithKeyword::getKeywordName(ElaboratedTypeKeyword Keyword) {
switch (Keyword) {
case ETK_None: return "";
case ETK_Typename: return "typename";
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 34954a8eeb8..54a332aa99e 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -11390,9 +11390,10 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation LocStart,
// a tag in front.
if (const RecordType *RT = T->getAs<RecordType>()) {
RecordDecl *RD = RT->getDecl();
-
- std::string InsertionText = std::string(" ") + RD->getKindName();
-
+
+ SmallString<16> InsertionText(" ");
+ InsertionText += RD->getKindName();
+
Diag(TypeRange.getBegin(),
getLangOpts().CPlusPlus11 ?
diag::warn_cxx98_compat_unelaborated_friend_type :
OpenPOWER on IntegriCloud