summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/cpp11-migrate/Core
diff options
context:
space:
mode:
authorEdwin Vane <edwin.vane@intel.com>2013-07-08 12:17:37 +0000
committerEdwin Vane <edwin.vane@intel.com>2013-07-08 12:17:37 +0000
commitaae33677f503c1215b97059c07f3a31d00cce4a2 (patch)
tree2163610b221476c464458eae5d1c20e2f2237ee9 /clang-tools-extra/cpp11-migrate/Core
parent0b900831688d358421a63fd8f6d24602a0a61a5e (diff)
downloadbcm5719-llvm-aae33677f503c1215b97059c07f3a31d00cce4a2.tar.gz
bcm5719-llvm-aae33677f503c1215b97059c07f3a31d00cce4a2.zip
cpp11-migrate: Tidying up
* Some file headers were missing for files in Core/ * Some headers were included but not necessary * CMakeLists.txt was linking in LLVMSupport even though CMakeLists in subdirs were linking it in too. * StringRefisation of constructors of types in FileOverrides.h * Other misc cleanups Author: Guillaume Papin <guillaume.papin@epitech.eu> llvm-svn: 185811
Diffstat (limited to 'clang-tools-extra/cpp11-migrate/Core')
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/FileOverrides.cpp16
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/FileOverrides.h8
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.cpp4
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.h7
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/PerfSupport.cpp2
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/PerfSupport.h7
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.cpp15
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.h4
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/Transform.cpp33
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/Transform.h15
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/Transforms.cpp2
-rw-r--r--clang-tools-extra/cpp11-migrate/Core/Transforms.h10
12 files changed, 89 insertions, 34 deletions
diff --git a/clang-tools-extra/cpp11-migrate/Core/FileOverrides.cpp b/clang-tools-extra/cpp11-migrate/Core/FileOverrides.cpp
index 81fca416157..b8e02d64f91 100644
--- a/clang-tools-extra/cpp11-migrate/Core/FileOverrides.cpp
+++ b/clang-tools-extra/cpp11-migrate/Core/FileOverrides.cpp
@@ -1,4 +1,20 @@
+//===-- Core/FileOverrides.cpp --------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief This file provides types and functionality for dealing with source
+/// and header file content overrides.
+///
+//===----------------------------------------------------------------------===//
+
#include "Core/FileOverrides.h"
+
#include "clang/Basic/SourceManager.h"
void SourceOverrides::applyOverrides(clang::SourceManager &SM) const {
diff --git a/clang-tools-extra/cpp11-migrate/Core/FileOverrides.h b/clang-tools-extra/cpp11-migrate/Core/FileOverrides.h
index 5f6988c646c..f8d21b53f56 100644
--- a/clang-tools-extra/cpp11-migrate/Core/FileOverrides.h
+++ b/clang-tools-extra/cpp11-migrate/Core/FileOverrides.h
@@ -12,9 +12,12 @@
/// and header file content overrides.
///
//===----------------------------------------------------------------------===//
+
#ifndef CPP11_MIGRATE_FILE_OVERRIDES_H
#define CPP11_MIGRATE_FILE_OVERRIDES_H
+#include "llvm/ADT/StringRef.h"
+
#include <map>
#include <string>
@@ -26,7 +29,8 @@ class FileManager;
/// \brief Container for storing override information for a single headers.
struct HeaderOverride {
- HeaderOverride(const char *FileName) : FileName(FileName) {}
+ HeaderOverride() {}
+ HeaderOverride(llvm::StringRef FileName) : FileName(FileName) {}
std::string FileName;
std::string FileOverride;
@@ -37,7 +41,7 @@ typedef std::map<std::string, HeaderOverride> HeaderOverrides;
/// \brief Container storing the file content overrides for a source file.
struct SourceOverrides {
- SourceOverrides(const std::string &MainFileName)
+ SourceOverrides(llvm::StringRef MainFileName)
: MainFileName(MainFileName) {}
/// \brief Convenience function for applying this source's overrides to
diff --git a/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.cpp b/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.cpp
index db66a37bfb0..23fe8989c1e 100644
--- a/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.cpp
+++ b/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.cpp
@@ -1,4 +1,4 @@
-//===-- Core/IncludeExcludeInfo.cpp - IncludeExclude class impl -*- C++ -*-===//
+//===-- Core/IncludeExcludeInfo.cpp - IncludeExclude class impl -----------===//
//
// The LLVM Compiler Infrastructure
//
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// \brief This file provides the implemention of the IncludeExcludeInfo class
+/// \brief This file provides the implementation of the IncludeExcludeInfo class
/// to handle the include and exclude command line options.
///
//===----------------------------------------------------------------------===//
diff --git a/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.h b/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.h
index 0d902623fb0..f55ec9f81cf 100644
--- a/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.h
+++ b/clang-tools-extra/cpp11-migrate/Core/IncludeExcludeInfo.h
@@ -12,8 +12,9 @@
/// to handle the include and exclude command line options.
///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
-#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
+
+#ifndef CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
+#define CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/system_error.h"
@@ -48,4 +49,4 @@ private:
std::vector<std::string> ExcludeList;
};
-#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
+#endif // CPP11_MIGRATE_INCLUDEEXCLUDEINFO_H
diff --git a/clang-tools-extra/cpp11-migrate/Core/PerfSupport.cpp b/clang-tools-extra/cpp11-migrate/Core/PerfSupport.cpp
index 2aa529526e0..e074bd123ef 100644
--- a/clang-tools-extra/cpp11-migrate/Core/PerfSupport.cpp
+++ b/clang-tools-extra/cpp11-migrate/Core/PerfSupport.cpp
@@ -1,4 +1,4 @@
-//===-- cpp11-migrate/Cpp11Migrate.cpp - Main file C++11 migration tool ---===//
+//===-- Core/PerfSupport.cpp - Perf measurement helpers -------------------===//
//
// The LLVM Compiler Infrastructure
//
diff --git a/clang-tools-extra/cpp11-migrate/Core/PerfSupport.h b/clang-tools-extra/cpp11-migrate/Core/PerfSupport.h
index 7858e9e9d5c..58ddded2207 100644
--- a/clang-tools-extra/cpp11-migrate/Core/PerfSupport.h
+++ b/clang-tools-extra/cpp11-migrate/Core/PerfSupport.h
@@ -1,4 +1,4 @@
-//===-- cpp11-migrate/PerfSupport.h - Perf measurement helpers --*- C++ -*-===//
+//===-- Core/PerfSupport.h - Perf measurement helpers -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -16,11 +16,12 @@
#ifndef CPP11_MIGRATE_PERFSUPPORT_H
#define CPP11_MIGRATE_PERFSUPPORT_H
-#include <map>
-#include <vector>
#include "Transform.h"
#include "llvm/ADT/StringRef.h"
+#include <map>
+#include <vector>
+
/// \brief A single piece of performance data: a duration in milliseconds and a
/// label for that duration.
struct PerfItem {
diff --git a/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.cpp b/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.cpp
index 8c29c816a88..9db47fadf69 100644
--- a/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.cpp
+++ b/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.cpp
@@ -1,3 +1,18 @@
+//===-- Core/SyntaxCheck.cpp ----------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief This file exposes functionaliy for doing a syntax-only check on
+/// files with overridden contents.
+///
+//===----------------------------------------------------------------------===//
+
#include "SyntaxCheck.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
diff --git a/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.h b/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.h
index 570f955a8bf..e845971af7a 100644
--- a/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.h
+++ b/clang-tools-extra/cpp11-migrate/Core/SyntaxCheck.h
@@ -12,12 +12,14 @@
/// files with overridden contents.
///
//===----------------------------------------------------------------------===//
+
#ifndef CPP11_MIGRATE_SYNTAX_CHECK_H
#define CPP11_MIGRATE_SYNTAX_CHECK_H
-#include <vector>
#include "Core/FileOverrides.h"
+#include <vector>
+
// Forward Declarations
namespace clang {
namespace tooling {
diff --git a/clang-tools-extra/cpp11-migrate/Core/Transform.cpp b/clang-tools-extra/cpp11-migrate/Core/Transform.cpp
index 92ccad74e7f..5754123a550 100644
--- a/clang-tools-extra/cpp11-migrate/Core/Transform.cpp
+++ b/clang-tools-extra/cpp11-migrate/Core/Transform.cpp
@@ -1,3 +1,18 @@
+//===-- Core/Transform.cpp - Transform Base Class Def'n -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// \brief This file provides the definition for the base Transform class from
+/// which all transforms must subclass.
+///
+//===----------------------------------------------------------------------===//
+
#include "Core/Transform.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/LangOptions.h"
@@ -69,7 +84,7 @@ private:
/// FileManager and a DiagnosticsEngine. Transform uses this class to create a
/// new Rewriter and SourceManager for every translation unit it transforms. A
/// DiagnosticsEngine doesn't need to be re-created so it's constructed once. A
-/// SourceManager and Rewriter and (re)created as required.
+/// SourceManager and Rewriter are (re)created as required.
///
/// FIXME: The DiagnosticsEngine should really come from somewhere more global.
/// It shouldn't be re-created once for every transform.
@@ -140,13 +155,12 @@ void collectResults(clang::Rewriter &Rewrite, SourceOverrides &Overrides) {
// in memory will always be necessary as the source goes down the transform
// pipeline.
- HeaderOverrides &Headers = Overrides.Headers;
- HeaderOverrides::iterator HeaderI = Headers.find(Entry->getName());
- if (HeaderI == Headers.end())
- HeaderI = Headers.insert(HeaderOverrides::value_type(
- Entry->getName(), Entry->getName())).first;
+ // Create HeaderOverride if not already existing
+ HeaderOverride &Header = Overrides.Headers[Entry->getName()];
+ if (Header.FileName.empty())
+ Header.FileName = Entry->getName();
- HeaderI->second.FileOverride = ResultBuf;
+ Header.FileOverride = ResultBuf;
}
}
@@ -169,7 +183,7 @@ bool Transform::isFileModifiable(const SourceManager &SM,
const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc));
if (!FE)
return false;
-
+
return GlobalOptions.ModifiableHeaders.isFileIncluded(FE->getName());
}
@@ -202,8 +216,7 @@ void Transform::handleEndSource() {
FileOverrides::iterator I = Overrides->find(CurrentSource);
if (I == Overrides->end())
- I = Overrides
- ->insert(FileOverrides::value_type(CurrentSource, CurrentSource)).first;
+ I = Overrides->insert(std::make_pair(CurrentSource, CurrentSource)).first;
collectResults(RewriterOwner->getRewriter(), I->second);
}
diff --git a/clang-tools-extra/cpp11-migrate/Core/Transform.h b/clang-tools-extra/cpp11-migrate/Core/Transform.h
index e273cf68c64..26462db7fe1 100644
--- a/clang-tools-extra/cpp11-migrate/Core/Transform.h
+++ b/clang-tools-extra/cpp11-migrate/Core/Transform.h
@@ -1,4 +1,4 @@
-//===-- cpp11-migrate/Transform.h - Transform Base Class Def'n --*- C++ -*-===//
+//===-- Core/Transform.h - Transform Base Class Def'n -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -8,15 +8,14 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// \brief This file provides the definition for the base Transform class from
+/// \brief This file provides the declaration for the base Transform class from
/// which all transforms must subclass.
///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORM_H
-#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORM_H
-#include <string>
-#include <vector>
+#ifndef CPP11_MIGRATE_TRANSFORM_H
+#define CPP11_MIGRATE_TRANSFORM_H
+
#include "Core/IncludeExcludeInfo.h"
#include "Core/FileOverrides.h"
#include "clang/Tooling/Refactoring.h"
@@ -24,6 +23,8 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Timer.h"
+#include <string>
+#include <vector>
/// \brief Description of the riskiness of actions that can be taken by
/// transforms.
@@ -223,4 +224,4 @@ private:
unsigned DeferredChanges;
};
-#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORM_H
+#endif // CPP11_MIGRATE_TRANSFORM_H
diff --git a/clang-tools-extra/cpp11-migrate/Core/Transforms.cpp b/clang-tools-extra/cpp11-migrate/Core/Transforms.cpp
index a9d8015f29f..e42baa4ca1e 100644
--- a/clang-tools-extra/cpp11-migrate/Core/Transforms.cpp
+++ b/clang-tools-extra/cpp11-migrate/Core/Transforms.cpp
@@ -1,4 +1,4 @@
-//===-- cpp11-migrate/Transforms.cpp - class Transforms Impl ----*- C++ -*-===//
+//===-- Core/Transforms.cpp - class Transforms Impl -----------------------===//
//
// The LLVM Compiler Infrastructure
//
diff --git a/clang-tools-extra/cpp11-migrate/Core/Transforms.h b/clang-tools-extra/cpp11-migrate/Core/Transforms.h
index c07df992574..53d039632a0 100644
--- a/clang-tools-extra/cpp11-migrate/Core/Transforms.h
+++ b/clang-tools-extra/cpp11-migrate/Core/Transforms.h
@@ -1,4 +1,4 @@
-//===-- cpp11-migrate/Transforms.h - class Transforms Def'n -----*- C++ -*-===//
+//===-- Core/Transforms.h - class Transforms Def'n --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,11 +13,13 @@
/// transformations to the user and applying requested transforms.
///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORMS_H
-#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORMS_H
+
+#ifndef CPP11_MIGRATE_TRANSFORMS_H
+#define CPP11_MIGRATE_TRANSFORMS_H
#include "llvm/Support/CommandLine.h"
#include "llvm/ADT/StringRef.h"
+
#include <vector>
// Forward declarations
@@ -75,4 +77,4 @@ private:
OptionVec Options;
};
-#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_TRANSFORMS_H
+#endif // CPP11_MIGRATE_TRANSFORMS_H
OpenPOWER on IntegriCloud