[llvm] r267910 - Fix some Clang-tidy modernize and Include What You Use warnings.
Eugene Zelenko via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 11:04:42 PDT 2016
Author: eugenezelenko
Date: Thu Apr 28 13:04:41 2016
New Revision: 267910
URL: http://llvm.org/viewvc/llvm-project?rev=267910&view=rev
Log:
Fix some Clang-tidy modernize and Include What You Use warnings.
Differential revision: http://reviews.llvm.org/D19673
Modified:
llvm/trunk/include/llvm/IR/DiagnosticInfo.h
llvm/trunk/include/llvm/IR/IRBuilder.h
llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
llvm/trunk/lib/IR/LLVMContext.cpp
llvm/trunk/unittests/ProfileData/SampleProfTest.cpp
Modified: llvm/trunk/include/llvm/IR/DiagnosticInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DiagnosticInfo.h?rev=267910&r1=267909&r2=267910&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DiagnosticInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DiagnosticInfo.h Thu Apr 28 13:04:41 2016
@@ -15,11 +15,13 @@
#ifndef LLVM_IR_DIAGNOSTICINFO_H
#define LLVM_IR_DIAGNOSTICINFO_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/DebugLoc.h"
-#include "llvm/IR/Module.h"
-#include "llvm/Support/Casting.h"
+#include "llvm/Support/CBindingWrapping.h"
+#include "llvm-c/Types.h"
#include <functional>
+#include <string>
namespace llvm {
@@ -27,9 +29,8 @@ namespace llvm {
class DiagnosticPrinter;
class Function;
class Instruction;
-class LLVMContextImpl;
-class Value;
-class DebugLoc;
+class LLVMContext;
+class Module;
class SMDiagnostic;
/// \brief Defines the different supported severity of a diagnostic.
@@ -91,7 +92,7 @@ public:
DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity)
: Kind(Kind), Severity(Severity) {}
- virtual ~DiagnosticInfo() {}
+ virtual ~DiagnosticInfo() = default;
/* DiagnosticKind */ int getKind() const { return Kind; }
DiagnosticSeverity getSeverity() const { return Severity; }
@@ -617,7 +618,7 @@ public:
const Twine &getMessage() const { return Msg; }
- void print(DiagnosticPrinter &DP) const;
+ void print(DiagnosticPrinter &DP) const override;
};
/// Emit a warning when loop vectorization is specified but fails. \p Fn is the
@@ -632,6 +633,6 @@ void emitLoopVectorizeWarning(LLVMContex
void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn,
const DebugLoc &DLoc, const Twine &Msg);
-} // End namespace llvm
+} // end namespace llvm
-#endif
+#endif // LLVM_IR_DIAGNOSTICINFO_H
Modified: llvm/trunk/include/llvm/IR/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=267910&r1=267909&r2=267910&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/IR/IRBuilder.h Thu Apr 28 13:04:41 2016
@@ -16,22 +16,42 @@
#define LLVM_IR_IRBUILDER_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/None.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantFolder.h"
+#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DebugLoc.h"
+#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/InstrTypes.h"
+#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Operator.h"
+#include "llvm/IR/Type.h"
+#include "llvm/IR/Value.h"
#include "llvm/IR/ValueHandle.h"
+#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/Casting.h"
+#include "llvm-c/Types.h"
+#include <cassert>
+#include <cstddef>
+#include <cstdint>
namespace llvm {
-class StringRef;
+
+class APInt;
class MDNode;
+class Module;
+class Use;
/// \brief This provides the default implementation of the IRBuilder
/// 'InsertHelper' method that is called whenever an instruction is created by
@@ -435,12 +455,14 @@ public:
Value *Mask);
/// \brief Create a call to Masked Gather intrinsic
- CallInst *CreateMaskedGather(Value *Ptrs, unsigned Align, Value *Mask = 0,
- Value *PassThru = 0, const Twine& Name = "");
+ CallInst *CreateMaskedGather(Value *Ptrs, unsigned Align,
+ Value *Mask = nullptr,
+ Value *PassThru = nullptr,
+ const Twine& Name = "");
/// \brief Create a call to Masked Scatter intrinsic
CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, unsigned Align,
- Value *Mask = 0);
+ Value *Mask = nullptr);
/// \brief Create an assume intrinsic call that allows the optimizer to
/// assume that the provided condition will be true.
Modified: llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h?rev=267910&r1=267909&r2=267910&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/MemorySSA.h Thu Apr 28 13:04:41 2016
@@ -68,6 +68,7 @@
// definitions, which would require multiple phis, and multiple memoryaccesses
// per instruction.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_TRANSFORMS_UTILS_MEMORYSSA_H
#define LLVM_TRANSFORMS_UTILS_MEMORYSSA_H
@@ -75,24 +76,41 @@
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/PHITransAddr.h"
+#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/Type.h"
+#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Pass.h"
+#include "llvm/PassAnalysisSupport.h"
+#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <iterator>
+#include <memory>
+#include <utility>
namespace llvm {
-class BasicBlock;
+
class DominatorTree;
class Function;
+class Instruction;
class MemoryAccess;
+class LLVMContext;
+class raw_ostream;
+
template <class T> class memoryaccess_def_iterator_base;
using memoryaccess_def_iterator = memoryaccess_def_iterator_base<MemoryAccess>;
using const_memoryaccess_def_iterator =
@@ -113,7 +131,8 @@ public:
return ID == MemoryUseVal || ID == MemoryPhiVal || ID == MemoryDefVal;
}
- virtual ~MemoryAccess();
+ ~MemoryAccess() override;
+
BasicBlock *getBlock() const { return Block; }
virtual void print(raw_ostream &OS) const = 0;
@@ -214,6 +233,7 @@ protected:
private:
Instruction *MemoryInst;
};
+
template <>
struct OperandTraits<MemoryUseOrDef>
: public FixedNumOperandTraits<MemoryUseOrDef, 1> {};
@@ -250,6 +270,7 @@ protected:
llvm_unreachable("MemoryUses do not have IDs");
}
};
+
template <>
struct OperandTraits<MemoryUse> : public FixedNumOperandTraits<MemoryUse, 1> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryUse, MemoryAccess)
@@ -293,6 +314,7 @@ protected:
private:
const unsigned ID;
};
+
template <>
struct OperandTraits<MemoryDef> : public FixedNumOperandTraits<MemoryDef, 1> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryDef, MemoryAccess)
@@ -447,7 +469,7 @@ protected:
/// For debugging only. This gets used to give memory accesses pretty numbers
/// when printing them out
- virtual unsigned getID() const final { return ID; }
+ unsigned getID() const final { return ID; }
private:
// For debugging only
@@ -463,8 +485,8 @@ private:
growHungoffUses(ReservedSpace, /* IsPhi */ true);
}
};
-template <> struct OperandTraits<MemoryPhi> : public HungoffOperandTraits<2> {};
+template <> struct OperandTraits<MemoryPhi> : public HungoffOperandTraits<2> {};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(MemoryPhi, MemoryAccess)
class MemorySSAWalker;
@@ -674,6 +696,7 @@ public:
/// starting from the use side of the memory def.
virtual MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,
MemoryLocation &) = 0;
+
/// \brief Given a memory access, invalidate anything this walker knows about
/// that access.
/// This API is used by walkers that store information to perform basic cache
@@ -733,7 +756,8 @@ using ConstMemoryAccessPair = std::pair<
class CachingMemorySSAWalker final : public MemorySSAWalker {
public:
CachingMemorySSAWalker(MemorySSA *, AliasAnalysis *, DominatorTree *);
- virtual ~CachingMemorySSAWalker();
+ ~CachingMemorySSAWalker() override;
+
MemoryAccess *getClobberingMemoryAccess(const Instruction *) override;
MemoryAccess *getClobberingMemoryAccess(MemoryAccess *,
MemoryLocation &) override;
@@ -821,6 +845,7 @@ private:
inline memoryaccess_def_iterator MemoryAccess::defs_begin() {
return memoryaccess_def_iterator(this);
}
+
inline const_memoryaccess_def_iterator MemoryAccess::defs_begin() const {
return const_memoryaccess_def_iterator(this);
}
@@ -940,7 +965,9 @@ private:
inline upward_defs_iterator upward_defs_begin(const MemoryAccessPair &Pair) {
return upward_defs_iterator(Pair);
}
+
inline upward_defs_iterator upward_defs_end() { return upward_defs_iterator(); }
-}
-#endif
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_UTILS_MEMORYSSA_H
Modified: llvm/trunk/lib/IR/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContext.cpp?rev=267910&r1=267909&r2=267910&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContext.cpp (original)
+++ llvm/trunk/lib/IR/LLVMContext.cpp Thu Apr 28 13:04:41 2016
@@ -13,16 +13,23 @@
//===----------------------------------------------------------------------===//
#include "llvm/IR/LLVMContext.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
#include "LLVMContextImpl.h"
-#include "llvm/IR/Constants.h"
-#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
-#include "llvm/IR/Instruction.h"
#include "llvm/IR/Metadata.h"
-#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/SourceMgr.h"
-#include <cctype>
+#include "llvm/IR/Module.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cassert>
+#include <cstdlib>
+#include <string>
+#include <utility>
+
using namespace llvm;
LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
@@ -142,6 +149,7 @@ LLVMContext::LLVMContext() : pImpl(new L
"gc-transition operand bundle id drifted!");
(void)GCTransitionEntry;
}
+
LLVMContext::~LLVMContext() { delete pImpl; }
void LLVMContext::addModule(Module *M) {
@@ -300,9 +308,11 @@ void LLVMContext::setGC(const Function &
}
It->second = std::move(GCName);
}
+
const std::string &LLVMContext::getGC(const Function &Fn) {
return pImpl->GCNames[&Fn];
}
+
void LLVMContext::deleteGC(const Function &Fn) {
pImpl->GCNames.erase(&Fn);
}
Modified: llvm/trunk/unittests/ProfileData/SampleProfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ProfileData/SampleProfTest.cpp?rev=267910&r1=267909&r2=267910&view=diff
==============================================================================
--- llvm/trunk/unittests/ProfileData/SampleProfTest.cpp (original)
+++ llvm/trunk/unittests/ProfileData/SampleProfTest.cpp Thu Apr 28 13:04:41 2016
@@ -1,5 +1,4 @@
-//===- unittest/ProfileData/SampleProfTest.cpp -------------------*- C++
-//-*-===//
+//===- unittest/ProfileData/SampleProfTest.cpp ------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -8,12 +7,27 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
+#include "llvm/IR/Module.h"
+#include "llvm/ProfileData/ProfileCommon.h"
+#include "llvm/ProfileData/SampleProf.h"
#include "llvm/ProfileData/SampleProfReader.h"
#include "llvm/ProfileData/SampleProfWriter.h"
+#include "llvm/Support/Casting.h"
+#include "llvm/Support/ErrorOr.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
#include "gtest/gtest.h"
-
-#include <cstdarg>
+#include <algorithm>
+#include <cstdint>
+#include <limits>
+#include <memory>
+#include <string>
+#include <system_error>
+#include <vector>
using namespace llvm;
using namespace sampleprof;
More information about the llvm-commits
mailing list