Commit Graph

66 Commits

Author SHA1 Message Date
Rafael Espindola 958297dabf Indicate success for simple options when clang called with -cc1.
Patch by David Wiberg.

llvm-svn: 187888
2013-08-07 12:54:47 +00:00
Fariborz Jahanian d83ef848bd ObjC migrator: Add -objcmt-migrate-property to do property
migration. Also, fixes an old bug where older migration 
flags were not being checked for properly.

llvm-svn: 185948
2013-07-09 16:59:14 +00:00
Jordan Rose b8859f6791 With CLANG_ENABLE_STATIC_ANALYZER=0, link clang properly and skip clang-check.
Previously, the CMake build still tried to link clang against the static
analyzer libraries, even if CLANG_ENABLE_STATIC_ANALYZER was off.
Furthermore, clang-check depends on the analyzer, so it should be disabled
(in both CMake and configure builds).

In theory, clang-check could be made to conditionally include analyzer
support (like clang itself), but for now this at least gets a CMake ALL_BUILD
working.

Patch by Stephen Kelly, modified by me.

llvm-svn: 185548
2013-07-03 16:20:29 +00:00
Reid Kleckner 898229ab4b [Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere

As discussed in the review, this change includes using directives in
header files.  I'll make follow up changes to remove those in favor of
name specifiers.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D975

llvm-svn: 183989
2013-06-14 17:17:23 +00:00
Douglas Gregor bf7fc9c542 <rdar://problem/13509689> Introduce -module-file-info option that provides information about a particular module file.
This option can be useful for end users who want to know why they
ended up with a ton of different variants of the "std" module in their
module cache. This problem should go away over time, as we reduce the
need for module variants, but it will never go away entirely.

llvm-svn: 178148
2013-03-27 16:47:18 +00:00
Sean Silva aa73d02032 use early returns to simplify and de-nest
llvm-svn: 171654
2013-01-06 07:49:41 +00:00
Roman Divacky d93c8c008e Dont use/link ARCMT, StaticAnalyzer and Rewriter to clang when the user
specifies not to. Dont build ASTMatchers with Rewriter disabled and
StaticAnalyzer when it's disabled.

Without all those three, the clang binary shrinks (x86_64) from ~36MB
to ~32MB (unstripped).

llvm-svn: 170135
2012-12-13 16:09:42 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Richard Smith e70ed8690f PR14303: Add a NoDriverOption flag to those options which are not accepted by
the driver (the options defined in CC1Options.td) and exclude their help from
"clang --help".

llvm-svn: 167638
2012-11-09 22:36:44 +00:00
Ted Kremenek cdf814900d Split library clangRewrite into clangRewriteCore and clangRewriteFrontend.
This is similar to how we divide up the StaticAnalyzer libraries to separate
core functionality to what is clearly associated with Frontend actions.

llvm-svn: 163050
2012-09-01 05:09:24 +00:00
Ted Kremenek 40ea0eaaa1 Make AnalyzerOptions a shared object between CompilerInvocation and
AnalysisManager, allowing the StringMap of configuration values to
be propagated.

llvm-svn: 162978
2012-08-31 04:36:05 +00:00
Alexander Kornienko 4de035947b Added -ast-list option to dump filterable AST decl node names.
llvm-svn: 161040
2012-07-31 09:37:40 +00:00
NAKAMURA Takumi 836926dbdf clang/lib: [CMake] Update tblgen'd dependencies.
llvm-svn: 160851
2012-07-27 06:18:33 +00:00
Chandler Carruth 28969b4139 Remove a goofy CMake hack and use the standard CMake facilities to
express library-level dependencies within Clang.

This is no more verbose really, and plays nicer with the rest of the
CMake facilities. It should also have no change in functionality.

llvm-svn: 158888
2012-06-21 01:30:21 +00:00
David Blaikie e993e4cd9b Support -frewrite-includes as an option while preprocessing.
llvm-svn: 158460
2012-06-14 17:36:09 +00:00
David Blaikie d5321247c4 Add a -rewrite-includes option, which is similar to -rewrite-macros, but only expands #include directives.
Patch contributed by Lubos Lunak (l.lunax@suse.cz).
Review by Matt Beaumont-Gay (matthewbg@google.com).

llvm-svn: 158093
2012-06-06 18:52:13 +00:00
Andrew Trick d4cfa2fe4c Fix cmake. Remaining two ClangCC1Options deps.
llvm-svn: 155977
2012-05-02 05:31:31 +00:00
James Molloy a3c85b8629 Unify Options.td and CC1Options.td, in a first step towards unifying the serialization logic in Frontend and Driver.
Reviewed by Eric, Doug and Chandler, and here: http://llvm.org/reviews/r/7/

llvm-svn: 155916
2012-05-01 14:57:16 +00:00
Douglas Gregor adfb842fc1 Remove the -cc1-level option "-pubnames-dump". Such things should stay
out of the tree and use the tooling infrastructure.

llvm-svn: 154668
2012-04-13 16:03:00 +00:00
Douglas Gregor 41ab2899b2 Introduce a -cc1-level option -pubnames-dump, which simply dumps the
list of identifiers that that 'public' names at the end of the
translation unit, e.g., defined macros or identifiers with top-level
names, in sorted order. Meant to support <rdar://problem/10921596>.

llvm-svn: 153522
2012-03-27 18:06:49 +00:00
Ted Kremenek f7639e1b4a Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator.  We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

llvm-svn: 152141
2012-03-06 20:06:33 +00:00
David Blaikie 09d20eefaa Make use of const-correct ParseCommandLineOptions
llvm-svn: 150000
2012-02-07 19:36:38 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Argyrios Kyrtzidis bd6a7d4c6c Fix ASTMerge tests that I broke in my previous commit.
llvm-svn: 149759
2012-02-04 03:26:16 +00:00
Argyrios Kyrtzidis 3d97a9beb9 Use variable in place of multiple CI.getFrontendOpts() calls and use a bit
of ArrayRef goodness. No functionality change.

llvm-svn: 149739
2012-02-04 01:36:04 +00:00
Argyrios Kyrtzidis 24e9afff43 Introduce 3 new fixit options:
-fixit-recompile
	applies fixits and recompiles the result
-fixit-to-temporary
	applies fixits to temporary files
-fix-only-warnings">,
    applies fixits for warnings only, not errors

Combining "-fixit-recompile -fixit-to-temporary" allows testing the result of fixits
without touching the original sources.

llvm-svn: 149027
2012-01-26 02:40:48 +00:00
David Blaikie f47fa304a4 Remove unnecessary default cases in switches over enums.
This allows -Wswitch-enum to find switches that need updating when these enums are modified.

llvm-svn: 148281
2012-01-17 02:30:50 +00:00
Chad Rosier 1332d9b26a Per discussion on the list, remove BitcodeVerify pass to reimplement as a free function.
llvm-svn: 146530
2011-12-14 00:29:23 +00:00
Chad Rosier c4399f779b Add frontend flags to enable bitcode verifier pass.
llvm-svn: 146441
2011-12-12 23:05:47 +00:00
Douglas Gregor 70db54f18d Eliminate the -emit-module option, which emitted a module by parsing a
source file (e.g., a header). Immediately steal this useful option
name for building modules from a module map file.

llvm-svn: 145444
2011-11-29 22:42:06 +00:00
Douglas Gregor 2b20cb87f5 Add support for building a module from a module map to the -cc1
interface. This is currently limited to modules with umbrella
headers.

llvm-svn: 144736
2011-11-16 00:09:06 +00:00
Douglas Gregor ac42ec6fc5 Revert r144703. It was a dumb idea anyway; will add the new bits more
incrementally with a new frontend action.

llvm-svn: 144723
2011-11-15 22:58:25 +00:00
Douglas Gregor 86b6f74217 Split GenerateModuleAction into its own action, which will start
differing from GeneratePCHAction fairly soon.

llvm-svn: 144703
2011-11-15 21:49:36 +00:00
Tobias Grosser 11ce922456 Parse LLVM command line arguments after plugins have been loaded
This fixes a crash due to command line options, that are not available
before the loading of plugins finished.

llvm-svn: 141525
2011-10-10 01:23:06 +00:00
Douglas Gregor 8a880e3ff6 Eliminate the unused -create-module cc1-level option
llvm-svn: 139827
2011-09-15 19:45:56 +00:00
Peter Collingbourne 2d7f219caf More missing dependencies picked up by Ninja.
llvm-svn: 139248
2011-09-07 19:12:36 +00:00
Douglas Gregor 69f74f80db Introduce a -cc1 option "-emit-module", that creates a binary module
from the given source. -emit-module behaves similarly to -emit-pch,
except that Sema is somewhat more strict about the contents of
-emit-module. In the future, there are likely to be more interesting
differences.

llvm-svn: 138595
2011-08-25 22:30:56 +00:00
Jordy Rose 59cce71af6 [analyzer] Overhaul of checker registration in preparation for basic plugin support. Removes support for checker groups (we can add them back in later if we decide they are still useful), and -analyzer-checker-help output is a little worse for the time being (no packages).
llvm-svn: 137758
2011-08-16 21:24:21 +00:00
Argyrios Kyrtzidis d571363e45 [arcmt] Add some additional driver flags to optionally emit or save the pre-migration ARC errors.
-arcmt-migrate-emit-errors : Emits the pre-migration ARC errors but it doesn't affect anything else
-arcmt-migrate-report-output : Writes out the pre-migration ARC errors to the provided plist file

rdar://9791454

llvm-svn: 135491
2011-07-19 17:20:03 +00:00
Argyrios Kyrtzidis 7fbd97f641 [arcmt] Introduce new '-ccc-arcmt-migrate <path>' ARC migration driver option.
This is a new mode of migration, where we avoid modifying the original files but
we emit temporary files instead.

<path> will be used to keep migration process metadata. Currently the temporary files
that are produced are put in the system's temp directory but we can put them
in the <path> if is necessary.

Also introduce new ARC migration functions in libclang whose only purpose,
currently, is to accept <path> and provide pairs of original file/transformed file
to map from the originals to the files after transformations are applied.

Finally introduce the c-arcmt-test utility that exercises the new libclang functions,
update arcmt-test, and add tests for the whole process.

rdar://9735086.

llvm-svn: 134844
2011-07-09 20:00:58 +00:00
Jonathan D. Turner f8c3ccdeae Remove BoostCon-specific code from Clang. FWIW, I'm a fan of things like this living in a separate branch.
llvm-svn: 134649
2011-07-07 22:40:15 +00:00
Argyrios Kyrtzidis 1240f4e53a [arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we hoped it would be.
llvm-svn: 133315
2011-06-17 23:49:31 +00:00
Chandler Carruth b570351059 Raise the ARCMT functionality in Clang into proper FrontendActions.
These are somewhat special in that they wrap any other FrontendAction,
running various ARC transformations or checks prior to the standard
action's run. To implement them easily, this extends FrontendAction to
have a WrapperFrontendAction utility class which forwards all calls by
default to an inner action setup at construction time. This is then
subclassed to override the specific behavior needed by the different
ARCMT tools.

Finally, FrontendTool is taught how to create these wrapper actions from
the existing flags and options structures.

The result is that clangFrontend no longer depends on clangARCMigrate.
This is very important, as clangARCMigrate *heavily* depends on
clangFrontend. Fundamentally ARCMigrate is at the same layer as
a library like Rewrite, sitting firmly on top of the Frontend, but tied
together with the FrontendTool when building the clang binary itself.

llvm-svn: 133161
2011-06-16 16:17:05 +00:00
Ted Kremenek 4f76f4ae31 Re-enable disable free optimization where the FrontendAction is not freed when -disable-free is passed. This accidentally was commited in r128011.
llvm-svn: 130168
2011-04-25 22:57:55 +00:00
Ted Kremenek 5e14d39a88 Improve crash recovery cleanup to recovery CompilerInstances during crash recovery. This was a huge resource "root" during crashes.
This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct
ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance
object.

llvm-svn: 128011
2011-03-21 18:40:17 +00:00
Douglas Gregor cfee35b845 Remove the AST printer (-ast-print-xml), which is too incomplete and
too low-level to actually be useful but is just interesting enough for
people to try to use it (which won't actually work beyond toy examples).

To bring back the AST printer, it needs to be:
  - Complete, covering all of C/C++/Objective-C
  - Documented, with appropriate Schema against which we can validate
  the output
  - Designed for C/C++/Objective-C, not Clang's specific ASTs
  - Stable across Clang versions
  - Well-tested

llvm-svn: 127141
2011-03-07 01:03:30 +00:00
Argyrios Kyrtzidis 17bee3e70a Intoduce '-analyzer-checker-help' flag which outputs a list of all available static analyzer checkers.
This is pretty basic for now, eventually checkers should be grouped according to package, hidden checkers should be indicated etc.

llvm-svn: 126454
2011-02-25 00:09:51 +00:00
Douglas Gregor d6f8124c9c Eliminate the internal command-line option for viewing inheritance in C++ classes, since it's only really worked for the trivial cases anyway due to lame pseudo-parsing of the class name. The viewInheritance() function is still available for use in the debugger, where this is far more useful
llvm-svn: 125762
2011-02-17 19:04:40 +00:00
Argyrios Kyrtzidis 556c45e9c5 [analyzer] Overhauling of the checker registration mechanism.
-Checkers will be defined in the tablegen file 'Checkers.td'.
-Apart from checkers, we can define checker "packages" that will contain a collection of checkers.
-Checkers can be enabled with -analyzer-checker=<name> and disabled with -analyzer-disable-checker=<name> e.g:
	Enable checkers from 'cocoa' and 'corefoundation' packages except the self-initialization checker:
	-analyzer-checker=cocoa -analyzer-checker=corefoundation -analyzer-disable-checker=cocoa.SelfInit
-Introduces CheckerManager and CheckerProvider. CheckerProviders get the set of checker names to enable/disable and
 register them with the CheckerManager which will be the entry point for all checker-related functionality.

Currently only the self-initialization checker takes advantage of the new mechanism.

llvm-svn: 125503
2011-02-14 18:13:31 +00:00
Argyrios Kyrtzidis ecd3334dac [analyzer] Introduce libclangStaticAnalyzerFrontend and move Checkers/AnalysisConsumer.cpp into Frontend lib.
llvm-svn: 125499
2011-02-14 18:13:01 +00:00