Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName(). This upgrades a bunch of
diags to take DeclNames instead of std::strings.
This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 80b5f20..f5f05f2 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -189,9 +189,8 @@
QualType CheckType = AllocType;
// To leverage the existing parser as much as possible, array types are
// parsed as VLAs. Unwrap for checking.
- if (const VariableArrayType *VLA = Context.getAsVariableArrayType(AllocType)){
+ if (const VariableArrayType *VLA = Context.getAsVariableArrayType(AllocType))
CheckType = VLA->getElementType();
- }
// Validate the type, and unwrap an array if any.
if (CheckAllocatedType(CheckType, StartLoc, SourceRange(TyStart, TyEnd)))
@@ -240,13 +239,13 @@
// 2) Otherwise, the object is direct-initialized.
CXXConstructorDecl *Constructor = 0;
Expr **ConsArgs = (Expr**)ConstructorArgs;
- if (CheckType->isRecordType()) {
+ if (const RecordType *RT = CheckType->getAsRecordType()) {
// FIXME: This is incorrect for when there is an empty initializer and
// no user-defined constructor. Must zero-initialize, not default-construct.
Constructor = PerformInitializationByConstructor(
CheckType, ConsArgs, NumConsArgs,
TyStart, SourceRange(TyStart, ConstructorRParen),
- CheckType.getAsString(),
+ RT->getDecl()->getDeclName(),
NumConsArgs != 0 ? IK_Direct : IK_Default);
if (!Constructor)
return true;
@@ -262,8 +261,9 @@
// Object is value-initialized. Do nothing.
} else if (NumConsArgs == 1) {
// Object is direct-initialized.
+ // FIXME: WHAT DeclarationName do we pass in here?
if (CheckInitializerTypes(ConsArgs[0], CheckType, StartLoc,
- CheckType.getAsString()))
+ DeclarationName() /*CheckType.getAsString()*/))
return true;
} else {
Diag(StartLoc, diag::err_builtin_direct_init_more_than_one_arg)