[cfe-commits] r91195 - in /cfe/trunk: NOTES.txt clang.xcodeproj/project.pbxproj test/CMakeLists.txt tools/CMakeLists.txt tools/Makefile tools/clang-cc/CMakeLists.txt tools/clang-cc/Makefile tools/clang-cc/clang-cc.cpp
Rafael Espindola
espindola at google.com
Sat Dec 12 08:36:56 PST 2009
Thanks!
2009/12/11 Daniel Dunbar <daniel at zuster.org>:
> Author: ddunbar
> Date: Fri Dec 11 18:56:47 2009
> New Revision: 91195
>
> URL: http://llvm.org/viewvc/llvm-project?rev=91195&view=rev
> Log:
> Remove clang-cc tool, it has joined in unholy union with clang.
> - tools/driver will be renamed to tools/clang at some point.
>
> Removed:
> cfe/trunk/tools/clang-cc/CMakeLists.txt
> cfe/trunk/tools/clang-cc/Makefile
> cfe/trunk/tools/clang-cc/clang-cc.cpp
> Modified:
> cfe/trunk/NOTES.txt
> cfe/trunk/clang.xcodeproj/project.pbxproj
> cfe/trunk/test/CMakeLists.txt
> cfe/trunk/tools/CMakeLists.txt
> cfe/trunk/tools/Makefile
>
> Modified: cfe/trunk/NOTES.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/NOTES.txt?rev=91195&r1=91194&r2=91195&view=diff
>
> ==============================================================================
> --- cfe/trunk/NOTES.txt (original)
> +++ cfe/trunk/NOTES.txt Fri Dec 11 18:56:47 2009
> @@ -17,7 +17,7 @@
> build).
>
> $ clang -ccc-pch-is-pth -x objective-c-header INPUTS/Cocoa_h.m -o /tmp/tokencache
> -$ clang-cc -token-cache /tmp/tokencache INPUTS/Cocoa_h.m
> +$ clang -cc1 -token-cache /tmp/tokencache INPUTS/Cocoa_h.m
>
> //===---------------------------------------------------------------------===//
>
>
> Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=91195&r1=91194&r2=91195&view=diff
>
> ==============================================================================
> --- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
> +++ cfe/trunk/clang.xcodeproj/project.pbxproj Fri Dec 11 18:56:47 2009
> @@ -54,7 +54,6 @@
> 1AE4EE3E103B89ED00888A23 /* StmtProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4EE3D103B89ED00888A23 /* StmtProfile.cpp */; };
> 1AE4EE40103B8A0A00888A23 /* TargetABIInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4EE3F103B8A0A00888A23 /* TargetABIInfo.cpp */; };
> 1AF1B50F109A4FB800AFAFAC /* CGException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF1B50E109A4FB800AFAFAC /* CGException.cpp */; };
> - 1AFEF4070F8A6B2300476F2B /* clang-cc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFEF4050F8A6B2300476F2B /* clang-cc.cpp */; };
> 1AFF8AE31012BFC900D248DA /* CGRecordLayoutBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFF8AE11012BFC900D248DA /* CGRecordLayoutBuilder.cpp */; };
> 3507E4C20E27FE2D00FB7B57 /* CheckObjCInstMethSignature.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3507E4C10E27FE2D00FB7B57 /* CheckObjCInstMethSignature.cpp */; };
> 352246E70F5C6BE000D0D279 /* HTMLDiagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 352246E10F5C6BE000D0D279 /* HTMLDiagnostics.cpp */; };
> @@ -280,6 +279,7 @@
> DEF7D9F70C9C8B1A0001F598 /* Rewriter.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEF7D9F60C9C8B1A0001F598 /* Rewriter.h */; };
> DEF7D9F90C9C8B1D0001F598 /* Rewriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEF7D9F80C9C8B1D0001F598 /* Rewriter.cpp */; };
> DEFFECA70DB1546600B4E7C3 /* DeltaTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEFFECA60DB1546600B4E7C3 /* DeltaTree.cpp */; };
> + E16B523510D30B2400430AC9 /* cc1_main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E16B523410D30B2400430AC9 /* cc1_main.cpp */; };
> /* End PBXBuildFile section */
>
> /* Begin PBXCopyFilesBuildPhase section */
> @@ -410,7 +410,6 @@
> 1AE4EE3D103B89ED00888A23 /* StmtProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = StmtProfile.cpp; path = lib/AST/StmtProfile.cpp; sourceTree = "<group>"; tabWidth = 2; };
> 1AE4EE3F103B8A0A00888A23 /* TargetABIInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = TargetABIInfo.cpp; path = lib/CodeGen/TargetABIInfo.cpp; sourceTree = "<group>"; tabWidth = 2; };
> 1AF1B50E109A4FB800AFAFAC /* CGException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGException.cpp; path = lib/CodeGen/CGException.cpp; sourceTree = "<group>"; tabWidth = 2; };
> - 1AFEF4050F8A6B2300476F2B /* clang-cc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = "clang-cc.cpp"; path = "tools/clang-cc/clang-cc.cpp"; sourceTree = "<group>"; tabWidth = 2; };
> 1AFF8AE11012BFC900D248DA /* CGRecordLayoutBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.cpp.cpp; name = CGRecordLayoutBuilder.cpp; path = lib/CodeGen/CGRecordLayoutBuilder.cpp; sourceTree = "<group>"; tabWidth = 2; };
> 1AFF8AE21012BFC900D248DA /* CGRecordLayoutBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.h; name = CGRecordLayoutBuilder.h; path = lib/CodeGen/CGRecordLayoutBuilder.h; sourceTree = "<group>"; tabWidth = 2; };
> 3507E4C10E27FE2D00FB7B57 /* CheckObjCInstMethSignature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckObjCInstMethSignature.cpp; path = lib/Analysis/CheckObjCInstMethSignature.cpp; sourceTree = "<group>"; };
> @@ -809,6 +808,7 @@
> DEF7D9F80C9C8B1D0001F598 /* Rewriter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Rewriter.cpp; path = lib/Rewrite/Rewriter.cpp; sourceTree = "<group>"; };
> DEFFECA30DB093D100B4E7C3 /* DeltaTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeltaTree.h; path = clang/Rewrite/DeltaTree.h; sourceTree = "<group>"; };
> DEFFECA60DB1546600B4E7C3 /* DeltaTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DeltaTree.cpp; path = lib/Rewrite/DeltaTree.cpp; sourceTree = "<group>"; };
> + E16B523410D30B2400430AC9 /* cc1_main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cc1_main.cpp; path = tools/driver/cc1_main.cpp; sourceTree = "<group>"; };
> /* End PBXFileReference section */
>
> /* Begin PBXFrameworksBuildPhase section */
> @@ -1542,23 +1542,15 @@
> 90F9EFA8104ABDC400D09A15 /* c-index-test */,
> 9012911E104812DA0083456D /* CIndex */,
> 90FD6DB4103D9763005F5B73 /* index-test */,
> - DEDFE6200F7B3AE90035BD10 /* clang-cc */,
> DEDFE6210F7B3AF10035BD10 /* clang */,
> );
> name = Tools;
> sourceTree = "<group>";
> };
> - DEDFE6200F7B3AE90035BD10 /* clang-cc */ = {
> - isa = PBXGroup;
> - children = (
> - 1AFEF4050F8A6B2300476F2B /* clang-cc.cpp */,
> - );
> - name = "clang-cc";
> - sourceTree = "<group>";
> - };
> DEDFE6210F7B3AF10035BD10 /* clang */ = {
> isa = PBXGroup;
> children = (
> + E16B523410D30B2400430AC9 /* cc1_main.cpp */,
> DEDFE6450F7B3B4E0035BD10 /* driver.cpp */,
> );
> name = clang;
> @@ -1875,7 +1867,6 @@
> 1A701B640F7C8FE400FEC4D1 /* SemaAccess.cpp in Sources */,
> 906BF4B00F83BA2E001071FA /* ConvertUTF.c in Sources */,
> DEDFF8880F848CF80035BD10 /* TemplateName.cpp in Sources */,
> - 1AFEF4070F8A6B2300476F2B /* clang-cc.cpp in Sources */,
> DEF165710F8FB34D0098507F /* PCHWriter.cpp in Sources */,
> DEF165750F8FB3510098507F /* PCHReader.cpp in Sources */,
> DEF168400F9548DC0098507F /* FixItRewriter.cpp in Sources */,
> @@ -1937,6 +1928,7 @@
> 1ADD795510A90C6100741BBA /* TypeLoc.cpp in Sources */,
> 1ADD795610A90C6100741BBA /* TemplateBase.cpp in Sources */,
> 1A986AB710D0746D00A8EA9E /* CGDeclCXX.cpp in Sources */,
> + E16B523510D30B2400430AC9 /* cc1_main.cpp in Sources */,
> );
> runOnlyForDeploymentPostprocessing = 0;
> };
>
> Modified: cfe/trunk/test/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=91195&r1=91194&r2=91195&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/CMakeLists.txt (original)
> +++ cfe/trunk/test/CMakeLists.txt Fri Dec 11 18:56:47 2009
> @@ -53,7 +53,7 @@
> --param build_config=${CMAKE_CFG_INTDIR}
> -sv ${CLANG_TEST_EXTRA_ARGS}
> ${CMAKE_CURRENT_BINARY_DIR}/${testdir}
> - DEPENDS clang clang-cc index-test c-index-test
> + DEPENDS clang index-test c-index-test
> COMMENT "Running Clang regression tests in ${testdir}")
> endforeach()
>
> @@ -64,7 +64,7 @@
> --param build_config=${CMAKE_CFG_INTDIR}
> -sv ${CLANG_TEST_EXTRA_ARGS}
> ${CMAKE_CURRENT_BINARY_DIR}
> - DEPENDS clang clang-cc index-test c-index-test
> + DEPENDS clang index-test c-index-test
> COMMENT "Running Clang regression tests")
>
> add_custom_target(clang-c++tests
> @@ -74,6 +74,6 @@
> --param build_config=${CMAKE_CFG_INTDIR}
> -sv ${CLANG_TEST_EXTRA_ARGS}
> ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests
> - DEPENDS clang clang-cc index-test c-index-test
> + DEPENDS clang index-test c-index-test
> COMMENT "Running Clang regression tests")
> endif()
>
> Modified: cfe/trunk/tools/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CMakeLists.txt?rev=91195&r1=91194&r2=91195&view=diff
>
> ==============================================================================
> --- cfe/trunk/tools/CMakeLists.txt (original)
> +++ cfe/trunk/tools/CMakeLists.txt Fri Dec 11 18:56:47 2009
> @@ -1,5 +1,4 @@
> add_subdirectory(CIndex)
> add_subdirectory(c-index-test)
> -add_subdirectory(clang-cc)
> add_subdirectory(driver)
> add_subdirectory(index-test)
>
> Modified: cfe/trunk/tools/Makefile
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/Makefile?rev=91195&r1=91194&r2=91195&view=diff
>
> ==============================================================================
> --- cfe/trunk/tools/Makefile (original)
> +++ cfe/trunk/tools/Makefile Fri Dec 11 18:56:47 2009
> @@ -8,6 +8,6 @@
> ##===----------------------------------------------------------------------===##
>
> LEVEL := ../../..
> -DIRS := clang-cc driver index-test CIndex c-index-test
> +DIRS := driver index-test CIndex c-index-test
>
> include $(LEVEL)/Makefile.common
>
> Removed: cfe/trunk/tools/clang-cc/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/CMakeLists.txt?rev=91194&view=auto
>
> ==============================================================================
> --- cfe/trunk/tools/clang-cc/CMakeLists.txt (original)
> +++ cfe/trunk/tools/clang-cc/CMakeLists.txt (removed)
> @@ -1,31 +0,0 @@
> -set(LLVM_NO_RTTI 1)
> -
> -set( LLVM_USED_LIBS
> - clangDriver
> - clangFrontend
> - clangCodeGen
> - clangAnalysis
> - clangRewrite
> - clangSema
> - clangAST
> - clangParse
> - clangLex
> - clangBasic
> - )
> -
> -set( LLVM_LINK_COMPONENTS
> - ${LLVM_TARGETS_TO_BUILD}
> - bitreader
> - bitwriter
> - codegen
> - ipo
> - selectiondag
> - )
> -
> -add_clang_executable(clang-cc
> - clang-cc.cpp
> - )
> -add_dependencies(clang-cc clang-headers)
> -
> -install(TARGETS clang-cc
> - RUNTIME DESTINATION libexec)
>
> Removed: cfe/trunk/tools/clang-cc/Makefile
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Makefile?rev=91194&view=auto
>
> ==============================================================================
> --- cfe/trunk/tools/clang-cc/Makefile (original)
> +++ cfe/trunk/tools/clang-cc/Makefile (removed)
> @@ -1,32 +0,0 @@
> -##===- tools/clang-cc/Makefile -----------------------------*- Makefile -*-===##
> -#
> -# The LLVM Compiler Infrastructure
> -#
> -# This file is distributed under the University of Illinois Open Source
> -# License. See LICENSE.TXT for details.
> -#
> -##===----------------------------------------------------------------------===##
> -LEVEL = ../../../..
> -
> -TOOLNAME = clang-cc
> -CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include
> -CXXFLAGS = -fno-rtti
> -
> -# Clang has no plugins, optimize startup time.
> -TOOL_NO_EXPORTS = 1
> -
> -# Include this here so we can get the configuration of the targets
> -# that have been configured for construction. We have to do this
> -# early so we can set up LINK_COMPONENTS before including Makefile.rules
> -include $(LEVEL)/Makefile.config
> -
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader bitwriter codegen ipo selectiondag
> -USEDLIBS = clangFrontend.a clangDriver.a clangCodeGen.a clangAnalysis.a \
> - clangRewrite.a clangSema.a clangAST.a clangParse.a \
> - clangLex.a clangBasic.a
> -
> -# clang-cc lives in a special location; we can get away with this
> -# because nothing else gets installed from here.
> -PROJ_bindir := $(DESTDIR)$(PROJ_prefix)/libexec
> -
> -include $(LLVM_SRC_ROOT)/Makefile.rules
>
> Removed: cfe/trunk/tools/clang-cc/clang-cc.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=91194&view=auto
>
> ==============================================================================
> --- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
> +++ cfe/trunk/tools/clang-cc/clang-cc.cpp (removed)
> @@ -1,339 +0,0 @@
> -//===--- clang.cpp - C-Language Front-end ---------------------------------===//
> -//
> -// The LLVM Compiler Infrastructure
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -//
> -// This utility may be invoked in the following manner:
> -// clang-cc --help - Output help info.
> -// clang-cc [options] - Read from stdin.
> -// clang-cc [options] file - Read from "file".
> -// clang-cc [options] file1 file2 - Read these files.
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#include "clang/Basic/Diagnostic.h"
> -#include "clang/Basic/FileManager.h"
> -#include "clang/Basic/SourceManager.h"
> -#include "clang/Basic/TargetInfo.h"
> -#include "clang/Basic/Version.h"
> -#include "clang/Driver/Arg.h"
> -#include "clang/Driver/ArgList.h"
> -#include "clang/Driver/CC1Options.h"
> -#include "clang/Driver/DriverDiagnostic.h"
> -#include "clang/Driver/OptTable.h"
> -#include "clang/Frontend/CompilerInstance.h"
> -#include "clang/Frontend/CompilerInvocation.h"
> -#include "clang/Frontend/FrontendActions.h"
> -#include "clang/Frontend/FrontendDiagnostic.h"
> -#include "clang/Frontend/FrontendPluginRegistry.h"
> -#include "clang/Frontend/TextDiagnosticBuffer.h"
> -#include "clang/Frontend/TextDiagnosticPrinter.h"
> -#include "clang/Frontend/VerifyDiagnosticsClient.h"
> -#include "llvm/LLVMContext.h"
> -#include "llvm/ADT/OwningPtr.h"
> -#include "llvm/Support/ErrorHandling.h"
> -#include "llvm/Support/ManagedStatic.h"
> -#include "llvm/Support/PrettyStackTrace.h"
> -#include "llvm/Support/raw_ostream.h"
> -#include "llvm/System/DynamicLibrary.h"
> -#include "llvm/System/Host.h"
> -#include "llvm/System/Path.h"
> -#include "llvm/System/Signals.h"
> -#include "llvm/Target/TargetSelect.h"
> -#include <cstdio>
> -using namespace clang;
> -
> -//===----------------------------------------------------------------------===//
> -// Main driver
> -//===----------------------------------------------------------------------===//
> -
> -void LLVMErrorHandler(void *UserData, const std::string &Message) {
> - Diagnostic &Diags = *static_cast<Diagnostic*>(UserData);
> -
> - Diags.Report(diag::err_fe_error_backend) << Message;
> -
> - // We cannot recover from llvm errors.
> - exit(1);
> -}
> -
> -static FrontendAction *CreateFrontendAction(CompilerInstance &CI) {
> - using namespace clang::frontend;
> -
> - switch (CI.getFrontendOpts().ProgramAction) {
> - default:
> - llvm::llvm_unreachable("Invalid program action!");
> -
> - case ASTDump: return new ASTDumpAction();
> - case ASTPrint: return new ASTPrintAction();
> - case ASTPrintXML: return new ASTPrintXMLAction();
> - case ASTView: return new ASTViewAction();
> - case DumpRawTokens: return new DumpRawTokensAction();
> - case DumpRecordLayouts: return new DumpRecordAction();
> - case DumpTokens: return new DumpTokensAction();
> - case EmitAssembly: return new EmitAssemblyAction();
> - case EmitBC: return new EmitBCAction();
> - case EmitHTML: return new HTMLPrintAction();
> - case EmitLLVM: return new EmitLLVMAction();
> - case EmitLLVMOnly: return new EmitLLVMOnlyAction();
> - case FixIt: return new FixItAction();
> - case GeneratePCH: return new GeneratePCHAction();
> - case GeneratePTH: return new GeneratePTHAction();
> - case InheritanceView: return new InheritanceViewAction();
> - case ParseNoop: return new ParseOnlyAction();
> - case ParsePrintCallbacks: return new PrintParseAction();
> - case ParseSyntaxOnly: return new SyntaxOnlyAction();
> -
> - case PluginAction: {
> - if (CI.getFrontendOpts().ActionName == "help") {
> - llvm::errs() << "clang-cc plugins:\n";
> - for (FrontendPluginRegistry::iterator it =
> - FrontendPluginRegistry::begin(),
> - ie = FrontendPluginRegistry::end();
> - it != ie; ++it)
> - llvm::errs() << " " << it->getName() << " - " << it->getDesc() << "\n";
> - return 0;
> - }
> -
> - for (FrontendPluginRegistry::iterator it =
> - FrontendPluginRegistry::begin(), ie = FrontendPluginRegistry::end();
> - it != ie; ++it) {
> - if (it->getName() == CI.getFrontendOpts().ActionName)
> - return it->instantiate();
> - }
> -
> - CI.getDiagnostics().Report(diag::err_fe_invalid_plugin_name)
> - << CI.getFrontendOpts().ActionName;
> - return 0;
> - }
> -
> - case PrintDeclContext: return new DeclContextPrintAction();
> - case PrintPreprocessedInput: return new PrintPreprocessedAction();
> - case RewriteBlocks: return new RewriteBlocksAction();
> - case RewriteMacros: return new RewriteMacrosAction();
> - case RewriteObjC: return new RewriteObjCAction();
> - case RewriteTest: return new RewriteTestAction();
> - case RunAnalysis: return new AnalysisAction();
> - case RunPreprocessorOnly: return new PreprocessOnlyAction();
> - }
> -}
> -
> -static int cc1_main(Diagnostic &Diags,
> - const char **ArgBegin, const char **ArgEnd,
> - const char *Argv0, void *MainAddr) {
> - using namespace clang::driver;
> -
> - llvm::errs() << "cc1 argv:";
> - for (const char **i = ArgBegin; i != ArgEnd; ++i)
> - llvm::errs() << " \"" << *i << '"';
> - llvm::errs() << "\n";
> -
> - // Parse the arguments.
> - OptTable *Opts = createCC1OptTable();
> - unsigned MissingArgIndex, MissingArgCount;
> - InputArgList *Args = Opts->ParseArgs(ArgBegin, ArgEnd,
> - MissingArgIndex, MissingArgCount);
> -
> - // Check for missing argument error.
> - if (MissingArgCount)
> - Diags.Report(clang::diag::err_drv_missing_argument)
> - << Args->getArgString(MissingArgIndex) << MissingArgCount;
> -
> - // Dump the parsed arguments.
> - llvm::errs() << "cc1 parsed options:\n";
> - for (ArgList::const_iterator it = Args->begin(), ie = Args->end();
> - it != ie; ++it)
> - (*it)->dump();
> -
> - // Create a compiler invocation.
> - llvm::errs() << "cc1 creating invocation.\n";
> - CompilerInvocation Invocation;
> - CompilerInvocation::CreateFromArgs(Invocation, ArgBegin, ArgEnd,
> - Argv0, MainAddr, Diags);
> -
> - // Convert the invocation back to argument strings.
> - std::vector<std::string> InvocationArgs;
> - Invocation.toArgs(InvocationArgs);
> -
> - // Dump the converted arguments.
> - llvm::SmallVector<const char*, 32> Invocation2Args;
> - llvm::errs() << "invocation argv :";
> - for (unsigned i = 0, e = InvocationArgs.size(); i != e; ++i) {
> - Invocation2Args.push_back(InvocationArgs[i].c_str());
> - llvm::errs() << " \"" << InvocationArgs[i] << '"';
> - }
> - llvm::errs() << "\n";
> -
> - // Convert those arguments to another invocation, and check that we got the
> - // same thing.
> - CompilerInvocation Invocation2;
> - CompilerInvocation::CreateFromArgs(Invocation2, Invocation2Args.begin(),
> - Invocation2Args.end(), Argv0, MainAddr,
> - Diags);
> -
> - // FIXME: Implement CompilerInvocation comparison.
> - if (true) {
> - //llvm::errs() << "warning: Invocations differ!\n";
> -
> - std::vector<std::string> Invocation2Args;
> - Invocation2.toArgs(Invocation2Args);
> - llvm::errs() << "invocation2 argv:";
> - for (unsigned i = 0, e = Invocation2Args.size(); i != e; ++i)
> - llvm::errs() << " \"" << Invocation2Args[i] << '"';
> - llvm::errs() << "\n";
> - }
> -
> - return 0;
> -}
> -
> -int main(int argc, char **argv) {
> - llvm::sys::PrintStackTraceOnErrorSignal();
> - llvm::PrettyStackTraceProgram X(argc, argv);
> - CompilerInstance Clang(&llvm::getGlobalContext(), false);
> -
> - // Run clang -cc1 test.
> - if (argc > 1 && llvm::StringRef(argv[1]) == "-cc1") {
> - TextDiagnosticPrinter DiagClient(llvm::errs(), DiagnosticOptions());
> - Diagnostic Diags(&DiagClient);
> - return cc1_main(Diags, (const char**) argv + 2, (const char**) argv + argc,
> - argv[0], (void*) (intptr_t) LLVMErrorHandler);
> - }
> -
> - // Initialize targets first, so that --version shows registered targets.
> - llvm::InitializeAllTargets();
> - llvm::InitializeAllAsmPrinters();
> -
> - // Buffer diagnostics from argument parsing so that we can output them using a
> - // well formed diagnostic object.
> - TextDiagnosticBuffer DiagsBuffer;
> - Diagnostic Diags(&DiagsBuffer);
> - CompilerInvocation::CreateFromArgs(Clang.getInvocation(),
> - (const char**) argv + 1,
> - (const char**) argv + argc, argv[0],
> - (void*)(intptr_t) LLVMErrorHandler,
> - Diags);
> -
> - // Honor -help.
> - if (Clang.getInvocation().getFrontendOpts().ShowHelp) {
> - llvm::OwningPtr<driver::OptTable> Opts(driver::createCC1OptTable());
> - Opts->PrintHelp(llvm::outs(), "clang-cc",
> - "LLVM 'Clang' Compiler: http://clang.llvm.org");
> - return 0;
> - }
> -
> - // Honor -version.
> - //
> - // FIXME: Use a better -version message?
> - if (Clang.getInvocation().getFrontendOpts().ShowVersion) {
> - llvm::cl::PrintVersionMessage();
> - return 0;
> - }
> -
> - // Create the actual diagnostics engine.
> - Clang.createDiagnostics(argc, argv);
> - if (!Clang.hasDiagnostics())
> - return 1;
> -
> - // Set an error handler, so that any LLVM backend diagnostics go through our
> - // error handler.
> - llvm::llvm_install_error_handler(LLVMErrorHandler,
> - static_cast<void*>(&Clang.getDiagnostics()));
> -
> - DiagsBuffer.FlushDiagnostics(Clang.getDiagnostics());
> -
> - // Load any requested plugins.
> - for (unsigned i = 0,
> - e = Clang.getFrontendOpts().Plugins.size(); i != e; ++i) {
> - const std::string &Path = Clang.getFrontendOpts().Plugins[i];
> - std::string Error;
> - if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), &Error))
> - Diags.Report(diag::err_fe_unable_to_load_plugin) << Path << Error;
> - }
> -
> - // If there were any errors in processing arguments, exit now.
> - if (Clang.getDiagnostics().getNumErrors())
> - return 1;
> -
> - // Create the target instance.
> - Clang.setTarget(TargetInfo::CreateTargetInfo(Clang.getDiagnostics(),
> - Clang.getTargetOpts()));
> - if (!Clang.hasTarget())
> - return 1;
> -
> - // Inform the target of the language options
> - //
> - // FIXME: We shouldn't need to do this, the target should be immutable once
> - // created. This complexity should be lifted elsewhere.
> - Clang.getTarget().setForcedLangOptions(Clang.getLangOpts());
> -
> - // Validate/process some options
> - if (Clang.getHeaderSearchOpts().Verbose)
> - llvm::errs() << "clang-cc version " CLANG_VERSION_STRING
> - << " based upon " << PACKAGE_STRING
> - << " hosted on " << llvm::sys::getHostTriple() << "\n";
> -
> - if (Clang.getFrontendOpts().ShowTimers)
> - Clang.createFrontendTimer();
> -
> - for (unsigned i = 0, e = Clang.getFrontendOpts().Inputs.size(); i != e; ++i) {
> - const std::string &InFile = Clang.getFrontendOpts().Inputs[i].second;
> -
> - // If we aren't using an AST file, setup the file and source managers and
> - // the preprocessor.
> - bool IsAST =
> - Clang.getFrontendOpts().Inputs[i].first == FrontendOptions::IK_AST;
> - if (!IsAST) {
> - if (!i) {
> - // Create a file manager object to provide access to and cache the
> - // filesystem.
> - Clang.createFileManager();
> -
> - // Create the source manager.
> - Clang.createSourceManager();
> - } else {
> - // Reset the ID tables if we are reusing the SourceManager.
> - Clang.getSourceManager().clearIDTables();
> - }
> -
> - // Create the preprocessor.
> - Clang.createPreprocessor();
> - }
> -
> - llvm::OwningPtr<FrontendAction> Act(CreateFrontendAction(Clang));
> - if (!Act)
> - break;
> -
> - if (Act->BeginSourceFile(Clang, InFile, IsAST)) {
> - Act->Execute();
> - Act->EndSourceFile();
> - }
> - }
> -
> - if (Clang.getDiagnosticOpts().ShowCarets)
> - if (unsigned NumDiagnostics = Clang.getDiagnostics().getNumDiagnostics())
> - fprintf(stderr, "%d diagnostic%s generated.\n", NumDiagnostics,
> - (NumDiagnostics == 1 ? "" : "s"));
> -
> - if (Clang.getFrontendOpts().ShowStats) {
> - Clang.getFileManager().PrintStats();
> - fprintf(stderr, "\n");
> - }
> -
> - // Return the appropriate status when verifying diagnostics.
> - //
> - // FIXME: If we could make getNumErrors() do the right thing, we wouldn't need
> - // this.
> - if (Clang.getDiagnosticOpts().VerifyDiagnostics)
> - return static_cast<VerifyDiagnosticsClient&>(
> - Clang.getDiagnosticClient()).HadErrors();
> -
> - // Managed static deconstruction. Useful for making things like
> - // -time-passes usable.
> - llvm::llvm_shutdown();
> -
> - return (Clang.getDiagnostics().getNumErrors() != 0);
> -}
> -
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
--
Rafael Ávila de Espíndola
More information about the cfe-commits
mailing list