diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /tools/llvm-diff | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'tools/llvm-diff')
-rw-r--r-- | tools/llvm-diff/DiffConsumer.h | 4 | ||||
-rw-r--r-- | tools/llvm-diff/DiffLog.h | 4 | ||||
-rw-r--r-- | tools/llvm-diff/DifferenceEngine.h | 4 | ||||
-rw-r--r-- | tools/llvm-diff/llvm-diff.cpp | 22 |
4 files changed, 16 insertions, 18 deletions
diff --git a/tools/llvm-diff/DiffConsumer.h b/tools/llvm-diff/DiffConsumer.h index ac13a5e..855f688 100644 --- a/tools/llvm-diff/DiffConsumer.h +++ b/tools/llvm-diff/DiffConsumer.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LLVM_DIFFCONSUMER_H_ -#define _LLVM_DIFFCONSUMER_H_ +#ifndef LLVM_TOOLS_LLVM_DIFF_DIFFCONSUMER_H +#define LLVM_TOOLS_LLVM_DIFF_DIFFCONSUMER_H #include "DiffLog.h" #include "llvm/ADT/DenseMap.h" diff --git a/tools/llvm-diff/DiffLog.h b/tools/llvm-diff/DiffLog.h index 43e318a..8eb53ff 100644 --- a/tools/llvm-diff/DiffLog.h +++ b/tools/llvm-diff/DiffLog.h @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LLVM_DIFFLOG_H_ -#define _LLVM_DIFFLOG_H_ +#ifndef LLVM_TOOLS_LLVM_DIFF_DIFFLOG_H +#define LLVM_TOOLS_LLVM_DIFF_DIFFLOG_H #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" diff --git a/tools/llvm-diff/DifferenceEngine.h b/tools/llvm-diff/DifferenceEngine.h index 4470968..f0d8311 100644 --- a/tools/llvm-diff/DifferenceEngine.h +++ b/tools/llvm-diff/DifferenceEngine.h @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LLVM_DIFFERENCE_ENGINE_H_ -#define _LLVM_DIFFERENCE_ENGINE_H_ +#ifndef LLVM_TOOLS_LLVM_DIFF_DIFFERENCEENGINE_H +#define LLVM_TOOLS_LLVM_DIFF_DIFFERENCEENGINE_H #include "DiffConsumer.h" #include "DiffLog.h" diff --git a/tools/llvm-diff/llvm-diff.cpp b/tools/llvm-diff/llvm-diff.cpp index f70219e..ae58f5c 100644 --- a/tools/llvm-diff/llvm-diff.cpp +++ b/tools/llvm-diff/llvm-diff.cpp @@ -32,21 +32,22 @@ using namespace llvm; /// Reads a module from a file. On error, messages are written to stderr /// and null is returned. -static Module *ReadModule(LLVMContext &Context, StringRef Name) { +static std::unique_ptr<Module> readModule(LLVMContext &Context, + StringRef Name) { SMDiagnostic Diag; - Module *M = ParseIRFile(Name, Diag, Context); + std::unique_ptr<Module> M = parseIRFile(Name, Diag, Context); if (!M) Diag.print("llvm-diff", errs()); return M; } -static void diffGlobal(DifferenceEngine &Engine, Module *L, Module *R, +static void diffGlobal(DifferenceEngine &Engine, Module &L, Module &R, StringRef Name) { // Drop leading sigils from the global name. if (Name.startswith("@")) Name = Name.substr(1); - Function *LFn = L->getFunction(Name); - Function *RFn = R->getFunction(Name); + Function *LFn = L.getFunction(Name); + Function *RFn = R.getFunction(Name); if (LFn && RFn) Engine.diff(LFn, RFn); else if (!LFn && !RFn) @@ -72,8 +73,8 @@ int main(int argc, char **argv) { LLVMContext Context; // Load both modules. Die if that fails. - Module *LModule = ReadModule(Context, LeftFilename); - Module *RModule = ReadModule(Context, RightFilename); + std::unique_ptr<Module> LModule = readModule(Context, LeftFilename); + std::unique_ptr<Module> RModule = readModule(Context, RightFilename); if (!LModule || !RModule) return 1; DiffConsumer Consumer; @@ -82,15 +83,12 @@ int main(int argc, char **argv) { // If any global names were given, just diff those. if (!GlobalsToCompare.empty()) { for (unsigned I = 0, E = GlobalsToCompare.size(); I != E; ++I) - diffGlobal(Engine, LModule, RModule, GlobalsToCompare[I]); + diffGlobal(Engine, *LModule, *RModule, GlobalsToCompare[I]); // Otherwise, diff everything in the module. } else { - Engine.diff(LModule, RModule); + Engine.diff(LModule.get(), RModule.get()); } - delete LModule; - delete RModule; - return Consumer.hadDifferences(); } |