summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaFixItUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaFixItUtils.cpp')
-rw-r--r--clang/lib/Sema/SemaFixItUtils.cpp29
1 files changed, 9 insertions, 20 deletions
diff --git a/clang/lib/Sema/SemaFixItUtils.cpp b/clang/lib/Sema/SemaFixItUtils.cpp
index 3cc26c09385..714fbedf09b 100644
--- a/clang/lib/Sema/SemaFixItUtils.cpp
+++ b/clang/lib/Sema/SemaFixItUtils.cpp
@@ -1,4 +1,4 @@
-//===- SemaFixItUtils.cpp - Sema FixIts -----------------------------------===//
+//===--- SemaFixItUtils.cpp - Sema FixIts ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -11,24 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include "clang/Sema/SemaFixItUtils.h"
#include "clang/AST/ASTContext.h"
-#include "clang/AST/DeclCXX.h"
-#include "clang/AST/DeclarationName.h"
-#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
-#include "clang/AST/Type.h"
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/LLVM.h"
-#include "clang/Basic/LangOptions.h"
-#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Sema.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Casting.h"
-#include <cassert>
-#include <string>
+#include "clang/Sema/SemaFixItUtils.h"
using namespace clang;
@@ -103,7 +91,7 @@ bool ConversionFixItGenerator::tryToFixConversion(const Expr *FullExpr,
// Check if the argument needs to be dereferenced:
// (type * -> type) or (type * -> type &).
- if (const auto *FromPtrTy = dyn_cast<PointerType>(FromQTy)) {
+ if (const PointerType *FromPtrTy = dyn_cast<PointerType>(FromQTy)) {
OverloadFixItKind FixKind = OFIK_Dereference;
bool CanConvert = CompareTypes(
@@ -115,7 +103,7 @@ bool ConversionFixItGenerator::tryToFixConversion(const Expr *FullExpr,
isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull))
return false;
- if (const auto *UO = dyn_cast<UnaryOperator>(Expr)) {
+ if (const UnaryOperator *UO = dyn_cast<UnaryOperator>(Expr)) {
if (UO->getOpcode() == UO_AddrOf) {
FixKind = OFIK_RemoveTakeAddress;
Hints.push_back(FixItHint::CreateRemoval(
@@ -148,7 +136,8 @@ bool ConversionFixItGenerator::tryToFixConversion(const Expr *FullExpr,
CanConvert = CompareTypes(S.Context.getPointerType(FromQTy), ToQTy,
S, Begin, VK_RValue);
if (CanConvert) {
- if (const auto *UO = dyn_cast<UnaryOperator>(Expr)) {
+
+ if (const UnaryOperator *UO = dyn_cast<UnaryOperator>(Expr)) {
if (UO->getOpcode() == UO_Deref) {
FixKind = OFIK_RemoveDereference;
Hints.push_back(FixItHint::CreateRemoval(
@@ -182,7 +171,7 @@ static std::string getScalarZeroExpressionForType(
// Suggest "0" for non-enumeration scalar types, unless we can find a
// better initializer.
if (T.isEnumeralType())
- return {};
+ return std::string();
if ((T.isObjCObjectPointerType() || T.isBlockPointerType()) &&
isMacroDefined(S, Loc, "nil"))
return "nil";
@@ -219,12 +208,12 @@ Sema::getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const {
const CXXRecordDecl *RD = T->getAsCXXRecordDecl();
if (!RD || !RD->hasDefinition())
- return {};
+ return std::string();
if (LangOpts.CPlusPlus11 && !RD->hasUserProvidedDefaultConstructor())
return "{}";
if (RD->isAggregate())
return " = {}";
- return {};
+ return std::string();
}
std::string
OpenPOWER on IntegriCloud