Sort includes according to style guidelines:

1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
This commit is contained in:
David Nadlinger
2013-02-07 19:36:29 +01:00
parent 5616753768
commit 0a96aea868
80 changed files with 550 additions and 614 deletions

View File

@@ -9,7 +9,8 @@
#include "driver/cl_options.h"
#include "gen/cl_helpers.h"
#include "gen/logger.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Target/TargetMachine.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/DataLayout.h"
@@ -19,10 +20,6 @@
#include "llvm/Target/TargetData.h"
#endif
#include "gen/logger.h"
#include "llvm/Support/CommandLine.h"
namespace opts {
// Positional options first, in order:

View File

@@ -12,17 +12,15 @@
//
//===----------------------------------------------------------------------===//
#ifndef LDC_CL_OPTIONS_H
#define LDC_CL_OPTIONS_H
#ifndef LDC_DRIVER_CL_OPTIONS_H
#define LDC_DRIVER_CL_OPTIONS_H
#include "mars.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/CommandLine.h"
#include <deque>
#include <vector>
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/CodeGen.h"
namespace opts {
namespace cl = llvm::cl;

View File

@@ -7,19 +7,15 @@
//
//===----------------------------------------------------------------------===//
#include <iostream>
#include <string>
#include <cassert>
#include <cstring>
#include "driver/configfile.h"
#include "mars.h"
#include "libconfig.h++"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "libconfig.h++"
#include "driver/configfile.h"
#include "mars.h"
#include <cassert>
#include <cstring>
#include <iostream>
#include <string>
namespace sys = llvm::sys;

View File

@@ -11,11 +11,13 @@
//
//===----------------------------------------------------------------------===//
#ifndef LDC_CONF_CONFIGFILE_H
#define LDC_CONF_CONFIGFILE_H
#ifndef LDC_DRIVER_CONFIGFILE_H
#define LDC_DRIVER_CONFIGFILE_H
#include <vector>
#include <string>
#include <vector>
namespace llvm { namespace sys { class Path; } }
namespace libconfig
{
@@ -48,4 +50,4 @@ private:
s_vector switches;
};
#endif // LDC_CONF_CONFIGFILE_H
#endif // LDC_DRIVER_CONFIGFILE_H

View File

@@ -48,6 +48,10 @@
# error "Please define LDC_EXE_NAME to the name of the LDC executable to use."
#endif
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cerrno>
#include <climits>
@@ -56,10 +60,6 @@
#include <cstdlib>
#include <numeric>
#include <vector>
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/raw_ostream.h"
#ifdef HAVE_SC_ARG_MAX
# include <unistd.h>

View File

@@ -7,26 +7,23 @@
//
//===----------------------------------------------------------------------===//
#include "driver/linker.h"
#include "mars.h"
#include "module.h"
#include "root.h"
#include "driver/cl_options.h"
#include "gen/llvm.h"
#include "llvm/Linker.h"
#include "gen/logger.h"
#include "gen/optimizer.h"
#include "gen/programs.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Linker.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Program.h"
#if _WIN32
#include "llvm/Support/SystemUtils.h"
#endif
#include "root.h"
#include "mars.h"
#include "module.h"
#include "gen/logger.h"
#include "gen/optimizer.h"
#include "gen/programs.h"
#include "driver/linker.h"
#include "driver/cl_options.h"
//////////////////////////////////////////////////////////////////////////////
// Is this useful?

View File

@@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef LDC_GEN_LINKER_H
#define LDC_GEN_LINKER_H
#ifndef LDC_DRIVER_LINKER_H
#define LDC_DRIVER_LINKER_H
#include "llvm/Support/CommandLine.h"
#include <vector>
@@ -55,4 +55,4 @@ void deleteExecutable();
*/
int runExecutable();
#endif // LDC_GEN_LINKER_H
#endif // LDC_DRIVER_LINKER_H

View File

@@ -7,9 +7,33 @@
//
//===----------------------------------------------------------------------===//
#include "gen/llvmcompat.h"
#include "id.h"
#include "json.h"
#include "mars.h"
#include "module.h"
#include "mtype.h"
#include "rmem.h"
#include "root.h"
#include "driver/cl_options.h"
#include "driver/configfile.h"
#include "driver/linker.h"
#include "driver/toobj.h"
#include "gen/cl_helpers.h"
#include "gen/irstate.h"
#include "gen/linkage.h"
#include "gen/llvm.h"
#include "gen/llvmcompat.h"
#include "gen/logger.h"
#include "gen/metadata.h"
#include "gen/optimizer.h"
#include "gen/passes/Passes.h"
#include "llvm/Linker.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#if LDC_LLVM_VER >= 303
#include "llvm/LinkAllIR.h"
#include "llvm/IR/LLVMContext.h"
@@ -17,54 +41,26 @@
#include "llvm/LinkAllVMCore.h"
#include "llvm/LLVMContext.h"
#endif
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/Host.h"
#include "llvm/MC/SubtargetFeature.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include "rmem.h"
#include "root.h"
#include <stdio.h>
#include <stdlib.h>
#if POSIX
#include <errno.h>
#elif _WIN32
#include <windows.h>
#endif
// stricmp
#if __GNUC__ && !_WIN32
#include "gnuc.h"
#endif
#include "mars.h"
#include "module.h"
#include "mtype.h"
#include "id.h"
// Needs Type already declared.
#include "cond.h"
#include "json.h"
#include "gen/logger.h"
#include "gen/linkage.h"
#include "gen/irstate.h"
#include "gen/optimizer.h"
#include "gen/metadata.h"
#include "gen/passes/Passes.h"
#include "driver/linker.h"
#include "driver/cl_options.h"
#include "gen/cl_helpers.h"
using namespace opts;
#include "driver/configfile.h"
#include "driver/toobj.h"
#if POSIX
#include <errno.h>
#elif _WIN32
#include <windows.h>
#endif
extern void getenv_setargv(const char *envvar, int *pargc, char** *pargv);
extern void backend_init();
extern void backend_term();

View File

@@ -7,26 +7,24 @@
//
//===----------------------------------------------------------------------===//
#include <cstddef>
#include <fstream>
#include "driver/toobj.h"
#include "gen/irstate.h"
#include "gen/logger.h"
#include "gen/optimizer.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/PassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Program.h"
#include "llvm/Target/TargetMachine.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Module.h"
#else
#include "llvm/Module.h"
#endif
#include "llvm/PassManager.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Target/TargetMachine.h"
#include "gen/irstate.h"
#include "gen/logger.h"
#include "gen/optimizer.h"
#include <cstddef>
#include <fstream>
// fwd decl
void emit_file(llvm::TargetMachine &Target, llvm::Module& m, llvm::raw_fd_ostream& Out,

View File

@@ -11,8 +11,12 @@
//
//===----------------------------------------------------------------------===//
#ifndef LDC_GEN_TOOBJ_H
#define LDC_GEN_TOOBJ_H
#ifndef LDC_DRIVER_TOOBJ_H
#define LDC_DRIVER_TOOBJ_H
#include <string>
namespace llvm { class Module; }
void writeModule(llvm::Module* m, std::string filename);