summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Teach Clang about PIE compilations. This is the first step of PR12380.Chandler Carruth2012-04-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, this patch cleans up the parsing of the PIC and PIE family of options in the driver. The existing logic failed to claim arguments all over the place resulting in kludges that marked the options as unused. Instead actually walk all of the arguments and claim them properly. We now treat -f{,no-}{pic,PIC,pie,PIE} as a single set, accepting the last one on the commandline. Previously there were lots of ordering bugs that could creep in due to the nature of the parsing. Let me know if folks would like weird things such as "-fPIE -fno-pic" to turn on PIE, but disable full PIC. This doesn't make any sense to me, but we could in theory support it. Options that seem to have intentional "trump" status (-static, -mkernel, etc) continue to do so and are commented as such. Next, a -pie-level flag is threaded into the frontend, rigged to a language option, and handled preprocessor, setting up the appropriate defines. We'll now have the correct defines when compiling with -fpie. The one place outside of the preprocessor that was inspecting the PIC level (as opposed to the relocation model, which is set and handled separately, yay!) is in the GNU ObjC runtime. I changed it to exactly preserve existing behavior. If folks want to change its behavior in the face of PIE, they can do that in a separate patch. Essentially the only functionality changed here is the preprocessor defines and bug-fixes to the argument management. Tests have been updated and extended to test all of this a bit more thoroughly. llvm-svn: 154291
* [analyzer] Enable retry exhausted without inlining by default.Anna Zaks2012-03-281-3/+3
| | | | llvm-svn: 153591
* Move the emission of strict enum range metadata behind a flag (the sameChandler Carruth2012-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | flag as GCC uses: -fstrict-enums). There is a *lot* of code making unwarranted assumptions about the underlying type of enums, and it doesn't seem entirely reasonable to eagerly break all of it. Much more importantly, the current state of affairs is *very* good at optimizing based upon this information, which causes failures that are very distant from the actual enum. Before we push for enabling this by default, I think we need to implement -fcatch-undefined-behavior support for instrumenting and trapping whenever we store or load a value outside of the range. That way we can track down the misbehaving code very quickly. I discussed this with Rafael, and currently the only important cases he is aware of are the bool range-based optimizations which are staying hard enabled. We've not seen any issue with those either, and they are much more important for performance. llvm-svn: 153550
* [analyzer] Add an option to re-analyze a dead-end path without inlining.Anna Zaks2012-03-271-0/+3
| | | | | | | | | | | | | | | | | | | | | The analyzer gives up path exploration under certain conditions. For example, when the same basic block has been visited more than 4 times. With inlining turned on, this could lead to decrease in code coverage. Specifically, if we give up inside the inlined function, the rest of parent's basic blocks will not get analyzed. This commit introduces an option to enable re-run along the failed path, in which we do not inline the last inlined call site. This is done by enqueueing the node before the processing of the inlined call site with a special policy encoded in the state. The policy tells us not to inline the call site along the path. This lead to ~10% increase in the number of paths analyzed. Even though we expected a much greater coverage improvement. The option is turned off by default for now. llvm-svn: 153534
* Introduce a -cc1-level option -pubnames-dump, which simply dumps theDouglas Gregor2012-03-271-0/+3
| | | | | | | | 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
* Driver: Factor string vector push_back into a helper class and optimize it.Benjamin Kramer2012-03-261-264/+174
| | | | | | | | | | Due to lack of move semantics we would create a temporary std::string from the string literal, copy it into the vector and discard the temporary. This leads to massive code bloat, optimizing it saves 50k on i386-linux-Release+Asserts. While there add a two-element overload for push_back, simplifying code a bit. llvm-svn: 153441
* [frontend] Fix how the frontend handles -fno-inline. AFAIK clang now matchesChad Rosier2012-03-151-6/+4
| | | | | | | the behavior of gcc with respect to the -fno-inline and -fno-inline-functions flags. llvm-svn: 152861
* [frontend] Add support for disabling the "inline" keyword using Chad Rosier2012-03-141-2/+3
| | | | | | | | | | | -fno-inline-functions. This behaves much like -fno-inline in gcc, but based on a discussion with Daniel it was decided that -fno-inline-functions should subsume -fno-inline. Please speak up if you object. The -fno-inline flag remains ignored. Final part of rdar://10972766 llvm-svn: 152754
* [driver] Parse diagnostic args in the driver.Chad Rosier2012-03-131-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | Previously, only diagnostics thrown by the cc1 process were actually honoring the diagnostic options given on the command line, like -Werror. Reuse the existing code in Frontend currently used for cc1, adjusting it to not interpret -Wl, linker flags as warnings. Also fix a faulty test exposed by this change. It wasn't actually testing anything, and was giving this warning: clang-3: warning: argument unused during compilation: '-verify' Which -Werror didn't turn into an error because it was output by the driver, not the cc1 process, and diagnostic options weren't parsed by the driver. And you couldn't see the warning when running the test suite. Fixes PR12181. Patch by Dylan Noblesmith <nobled@dreamwidth.org>. llvm-svn: 152660
* [analyzer] Add support for NoRedundancy inlining mode.Anna Zaks2012-03-091-1/+1
| | | | | | | | | | | We do not reanalyze a function, which has already been analyzed as an inlined callee. As per PRELIMINARY testing, this gives over 50% run time reduction on some benchmarks without decreasing of the number of bugs found. Turning the mode on by default. llvm-svn: 152440
* [Basic] Rename LangOptions::NoInline to NoInlineDefine, to make things a bitDaniel Dunbar2012-03-091-1/+1
| | | | | | more obvious. llvm-svn: 152408
* [analyzer] Rework inlining related command line options.Anna Zaks2012-03-081-3/+63
| | | | | | | | | - Remove -analyzer-inline-call. - Add -analyzer-ipa=[none|inlining] - Add -analyzer-inlining-mode to allow experimentation for different performance tuning methods. llvm-svn: 152351
* Workaround module test failures by removing the version info from module hashes.Bob Wilson2012-03-071-1/+4
| | | | | | | | | | PR12196: The module hash strings are not actually hashing the compiler version string; the entire version string is being included in the hash. Depending on the module cache directory name, that can lead to failures where the path names become too long. As a temporary workaround, just remove the version string from the hash. llvm-svn: 152266
* [driver] What was implemented in r152130 was actually -fno-inline-functions, notChad Rosier2012-03-061-3/+4
| | | | | | | -fno-inline. Part of rdar://10972766 llvm-svn: 152145
* Add new code migrator support for migrating existing Objective-C code to useTed Kremenek2012-03-061-5/+26
| | | | | | | | | | | 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
* [driver] Add support for -fno-inline.Chad Rosier2012-03-061-2/+4
| | | | | | rdar://10972766 llvm-svn: 152130
* [analyzer] Bound the size of the functions being inlined + provideAnna Zaks2012-03-021-0/+6
| | | | | | | | | | | command line options for inlining tuning. This adds the option for stack depth bound as well as function size bound. + minor doxygenification llvm-svn: 151930
* [analyzer] Turn inlining on by default for better testing exposure.Anna Zaks2012-03-011-1/+2
| | | | | | Fix a test, which was most likely an unintended recursive call. llvm-svn: 151848
* Add a flag -fthread-sanitizer.Kostya Serebryany2012-03-011-0/+3
| | | | | | | | | | This flag enables ThreadSanitizer instrumentation committed to llvm as r150423. The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer. This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet committed and it's structure in compiler-rt is not 100% clear. The users manual wil be changed in a separate commit. llvm-svn: 151846
* [analyzer] Add -analyzer-stats, which hooks up LLVM stats tracking.Anna Zaks2012-02-271-0/+1
| | | | | | As in http://llvm.org/docs/ProgrammersManual.html#Statistic llvm-svn: 151570
* Basic: import IntrusiveRefCntPtr<> into clang namespaceDylan Noblesmith2012-02-201-1/+1
| | | | | | | The class name is long enough without the llvm:: added. Also bring in RefCountedBase and RefCountedBaseVPTR. llvm-svn: 150958
* Remove the unuseful -fdiagnostics-show-nameDavid Blaikie2012-02-151-3/+0
| | | | | | | | | | | | | | This option was added in r129614 and doesn't have any use case that I'm aware of. It's possible that external tools are using these names - and if that's the case we can certainly reassess the functionality, but for now it lets us shave out a few unneeded bits from clang. Move the "StaticDiagNameIndex" table into the only remaining consumer, diagtool. This removes the actual diagnostic name strings from clang entirely. Reviewed by Chris Lattner & Ted Kremenek. llvm-svn: 150612
* Invalid O levels on the command line no longer have a confusing error.Aaron Ballman2012-02-061-4/+5
| | | | llvm-svn: 149852
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-2/+2
| | | | llvm-svn: 149798
* Clang has existing support for debuggers thatSean Callanan2012-02-041-0/+3
| | | | | | | | | | | | | | | | | | | | want to provide "po"-like functionality which treats the result of an expression implicitly as "id" (if it is not otherwise known) and prints it as an Objective-C object. This has in the past been gated by the "DebuggerSupport" language option, but that is too general. Debuggers also provide other commands like "print" that do not make any assumptions about whether the object is an Objective-C object. This patch makes the assumption conditional on a new language option: DebuggerCastResultToId. I have also made corresponding modifications to the testsuite. llvm-svn: 149735
* Fix -ftrap-function fallout from llvm r145714. <rdar://problem/10799325>Bob Wilson2012-02-031-0/+1
| | | | | | | | | That llvm change removed the -trap-func backend option, so that using -ftrap-function with clang would cause the backend to complain. Fix it by adding the trap function name to the CodeGenOptions and passing it through to the TargetOptions. llvm-svn: 149679
* Rename -dependency-graphviz to -dependencncy-dotDouglas Gregor2012-02-021-1/+1
| | | | llvm-svn: 149645
* Introduce a -cc1 option "-dependency-graphviz" that determines headerDouglas Gregor2012-02-021-0/+1
| | | | | | dependencies and outputs them in GraphViz format. llvm-svn: 149575
* Complain about attempts to use 'protected' visibility on targetsJohn McCall2012-01-291-0/+1
| | | | | | | | like Darwin that don't support it. We should also complain about invalid -fvisibility=protected, but that information doesn't seem to exist at the most appropriate time, so I've left a FIXME behind. llvm-svn: 149186
* objc-arc: introduce -no-finalize-removal which in gc mode,Fariborz Jahanian2012-01-261-0/+1
| | | | | | | | leaves "finalize' behind and in arc mode, does not include it. This allows the migrated source to be compiled in both gc and arc mode. // rdar://10532441 llvm-svn: 149079
* Extend the ExternalASTSource interface to allow the AST source toDouglas Gregor2012-01-261-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | provide the layout of records, rather than letting Clang compute the layout itself. LLDB provides the motivation for this feature: because various layout-altering attributes (packed, aligned, etc.) don't get reliably get placed into DWARF, the record layouts computed by LLDB from the reconstructed records differ from the actual layouts, and badness occurs. This interface lets the DWARF data drive layout, so we don't need the attributes preserved to get the answer write. The testing methodology for this change is fun. I've introduced a variant of -fdump-record-layouts called -fdump-record-layouts-simple that always has the simple C format and provides size/alignment/field offsets. There is also a -cc1 option -foverride-record-layout=<file> to take the output of -fdump-record-layouts-simple and parse it to produce a set of overridden layouts, which is introduced into the AST via a testing-only ExternalASTSource (called LayoutOverrideSource). Each test contains a number of records to lay out, which use various layout-changing attributes, and then dumps the layouts. We then run the test again, using the preprocessor to eliminate the layout-changing attributes entirely (which would give us different layouts for the records), but supplying the previously-computed record layouts. Finally, we diff the layouts produced from the two runs to be sure that they are identical. Note that this code makes the assumption that we don't *have* to provide the offsets of bases or virtual bases to get the layout right, because the alignment attributes don't affect it. I believe this assumption holds, but if it does not, we can extend LayoutOverrideSource to also provide base offset information. Fixes the Clang side of <rdar://problem/10169539>. llvm-svn: 149055
* Introduce 3 new fixit options:Argyrios Kyrtzidis2012-01-261-0/+9
| | | | | | | | | | | | | | -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
* arc migrator: Provide infrastructure to add optionsFariborz Jahanian2012-01-251-0/+6
| | | | | | | | | specific to migrator. Use its first option to warn migrating from GC to arc when NSAllocateCollectable/NSReallocateCollectable is used. // rdar://10532541 llvm-svn: 148887
* Add support for -fno-optimize-sibling-calls. Currently only implemented in theNick Lewycky2012-01-231-0/+3
| | | | | | X86 backend in LLVM. llvm-svn: 148689
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-2/+0
| | | | llvm-svn: 148577
* Extract the (InputKind, std::string) pair used to describe inputs toDouglas Gregor2012-01-201-6/+6
| | | | | | | the front end into its own class, FrontendInputFile, to make it easier to introduce new per-input data. No functionality change. llvm-svn: 148546
* Add a "Modules" language option, which subsumes the previousDouglas Gregor2012-01-031-1/+3
| | | | | | "AutoModuleImport" preprocessor option and is tied to -fmodules. llvm-svn: 147448
* Rename the command-line option for mapping #include/#import over toDouglas Gregor2012-01-031-1/+1
| | | | | | | | module imports from -fauto-module-import to -fmodules. The new name will eventually be used to enable modules, and the #include/#import mapping is a crucial part of the feature. llvm-svn: 147447
* Fix PR11685 by implementing -ffast-math and its various friends in theChandler Carruth2012-01-021-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Clang driver. This involves a bunch of silly option parsing code to try to carefully emulate GCC's options. Currently, this takes a conservative approach, and unless all of the unsafe optimizations are enabled, none of them are. The fine grained control doesn't seem particularly useful. If it ever becomes useful, we can add that to LLVM first, and then expose it here. This also fixes a few tiny bugs in the flag management around -fhonor-infinities and -fhonor-nans; the flags now form proper sets both for enabling and disabling, with the last flag winning. I've also implemented a moderately terrifying GCC feature where a language change is also provided by the '-ffast-math' flag by defining the __FAST_MATH__ preprocessor macro. This feature is tracked and serialized in the frontend but it isn't used yet. A subsequent patch will add the preprocessor macro and tests for it. I've manually tested that codegen appears to respect this, but I've not dug in enough to see if there is an easy way to test codegen options w/o relying on the particulars of LLVM's optimizations. llvm-svn: 147434
* Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" ↵Benjamin Kramer2011-12-231-1/+1
| | | | | | | | so this patch is surprisingly small. Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility. llvm-svn: 147221
* Let CompilerInvocation initialization indicate failureDylan Noblesmith2011-12-231-29/+61
| | | | | | | | | This fixes the FIXMEs in ParseAnalyzeArgs. (Also a precursor to moving the analyzer into an AST plugin.) For consistency, do the same with AssemblerInvocation. llvm-svn: 147218
* C++11 constexpr: Add note stacks containing backtraces if constant evaluationRichard Smith2011-12-161-0/+9
| | | | | | | | | | fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit argument to driver and frontend, to control the maximum number of notes so produced (default 10). Fix APValue printing to be able to pretty-print all APValue types, and move the testing for this functionality from a unittest to a -verify test now that it's visible in clang's output. llvm-svn: 146749
* Per discussion on the list, remove BitcodeVerify pass to reimplement as a ↵Chad Rosier2011-12-141-3/+0
| | | | | | free function. llvm-svn: 146530
* Add frontend flags to enable bitcode verifier pass.Chad Rosier2011-12-121-0/+3
| | | | llvm-svn: 146441
* Hexagon backend supportTony Linthicum2011-12-121-0/+1
| | | | llvm-svn: 146413
* Driver: Handle -f{no-}honor-infinities, -f{no-}honor-nans, andDaniel Dunbar2011-12-091-2/+10
| | | | | | | | -ffinite-math-only. - No test case yet, I don't know how to construct a situation where this matters. llvm-svn: 146297
* Stack realignment is a tristate. Add -mno-stackrealign to turn off all stackNick Lewycky2011-12-061-1/+1
| | | | | | realignment, even with locals with alignment exceeding the ABI guarantee. llvm-svn: 145909
* Add -mstack-alignment=X and fix -mstackrealign handling now that theJoerg Sonnenberger2011-12-051-0/+5
| | | | | | backend options are gone. llvm-svn: 145868
* Eliminate the -emit-module option, which emitted a module by parsing aDouglas Gregor2011-11-291-3/+0
| | | | | | | source file (e.g., a header). Immediately steal this useful option name for building modules from a module map file. llvm-svn: 145444
* Silence GCC warnings, RefCountedBase is meant to be default-initialized here.Benjamin Kramer2011-11-291-1/+2
| | | | llvm-svn: 145396
OpenPOWER on IntegriCloud