summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Set __OPTIMIZE_SIZE__ on -Os and -Oz. This matches gcc's behaviour on both OS XRafael Espindola2011-11-261-1/+1
| | | | | | and linux. llvm-svn: 145142
* implement __has_feature(address_sanitizer); also use ↵Kostya Serebryany2011-11-221-3/+3
| | | | | | LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer llvm-svn: 145054
* Add driver arguments -ftemplate-depth=N and -fconstexpr-depth=N, with the sameRichard Smith2011-11-211-1/+7
| | | | | | | | | | | | | semantics and defaults as the corresponding g++ arguments. The historical g++ argument -ftemplate-depth-N is kept for compatibility, but modern g++ versions no longer document that option. Add -cc1 argument -fconstexpr-depth N to implement the corresponding functionality. The -ftemplate-depth=N part of this fixes PR9890. llvm-svn: 145045
* Refine placement of LangOptions object in CompilerInvocation by adding a new ↵Ted Kremenek2011-11-181-4/+3
| | | | | | baseclass CompilerInvocationBase with a custom copy constructor. This ensures that whenever the CompilerInvocation object's copy constructor is used we always clone the LangOptions object. llvm-svn: 144973
* Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted ↵Ted Kremenek2011-11-171-5/+20
| | | | | | | | | | | | | | | | | object. I discovered that llvm::RefCountedBase<T> has a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation objects created by ASTUnit were actually leaked. When I fixed that bug locally, it showed that a whole bunch of code assumed that the LangOptions object that was part of CompilerInvocation was still alive. By making it heap-allocated and reference counted, we can keep it around after the CompilerInvocation object goes away. As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this object may outlive the CompilerInvocation object. This commit doesn't fix the CompilerInvocation leak itself. That will come when I commit the fix to llvm::RefCountedBase<T> to mainline LLVM. llvm-svn: 144930
* Add -f[no-]address-sanitizer flagKostya Serebryany2011-11-161-0/+3
| | | | llvm-svn: 144800
* Add support for building a module from a module map to the -cc1Douglas Gregor2011-11-161-0/+3
| | | | | | | interface. This is currently limited to modules with umbrella headers. llvm-svn: 144736
* Add a -cc1-level option -fmodule-name=<name>, which will be used whenDouglas Gregor2011-11-151-0/+3
| | | | | | building modules. llvm-svn: 144680
* Rip out one of the features I added for the driver-include-management.Chandler Carruth2011-11-071-8/+3
| | | | | | | | | | | | | | | | We don't actually need a separate flag for non-sysrooted paths as the driver has to manage the sysroot anyways. The driver is not infrequently adding paths to the header search based on their existence on the filesystem. For that, it has to add the sysroot anyways, we should pass it on down to CC1 already joined. More importantly, the driver cannot in all cases distinguish between sysrooted paths and paths that are relative to the Clang binary's installation directory. Essentially, we always need to ignore the system root for these internal header search options. It turns out in most of the places we were already providing the system root in the driver, and then another one in CC1 so this fixes several bugs. llvm-svn: 143917
* Fix a significant oversight in my move of MSVC includes to the driver:Chandler Carruth2011-11-051-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | actually manage the builtin header file includes as well as the system ones. This one is actually debatable whether it belongs in the driver or not, as the builtin includes are really an internal bit of implementation goop for Clang. However, they must be included at *exactly* the right point in the sequence of header files, which makes it essentially impossible to have this be managed by the Frontend and the rest by the Driver. I have terrible ideas that would "work", but I think they're worse than putting this in the driver and making the Frontend library even more ignorant of the environment and system on which it is being run. Also fix the fact that we weren't properly respecting the flags which suppress standard system include directories. Note that this still leaves all of the Clang tests which run CC1 directly and include builtin header files broken on Windows. I'm working on a followup patch to address that. llvm-svn: 143801
* Add two flags to the CC1 layer that I was hoping to avoid. We need toChandler Carruth2011-11-051-4/+19
| | | | | | | | | | | | | | | | | | | | encode the *exact* semantics which the header search paths internally built by the Frontend layer have had, which is both non-user-provided, and at times adding the implicit extern "C" bit to the directory entry. There are lots of CC1 options that are very close, but none do quite this, and they are all already overloaded for other purposes. In some senses this makes the command lines more clean as it clearly indicates which flags are exclusively used to implement internal detection of "standard" header search paths. Lots of the implementation of this is really crufty, due to the surrounding cruft. It doesn't seem worth investing lots of time cleaning this up as it isn't new, and hopefully *lots* of this code will melt away as header search inside of the frontend becomes increasingly trivial. llvm-svn: 143798
* Enable -flimit-debug-info by default. Now, clang lazily emits debug info for ↵Devang Patel2011-11-041-1/+2
| | | | | | structs. Original behavior can be restored using -fno-limit-debug-info. llvm-svn: 143733
* Fix various minor issues find via unreachable code warnings, fromDouglas Gregor2011-11-021-1/+2
| | | | | | Ahmed Charles! llvm-svn: 143569
* Add an option to emulate the strange Apple gcc behavior of #pragma pack.Eli Friedman2011-11-021-0/+3
| | | | | | <rdar://problem/10374763> llvm-svn: 143527
* rename getHostTriple into getDefaultTargetTriple in clangSebastian Pop2011-11-011-2/+2
| | | | llvm-svn: 143503
* Add support for lazily linking bitcode files (using a newPeter Collingbourne2011-10-301-0/+1
| | | | | | | -mlink-bitcode-file flag), and more generally llvm::Modules, before running optimisations. llvm-svn: 143314
* Start work on SerializedDiagnosticPrinter, a new DiagnosticConsumer that ↵Ted Kremenek2011-10-291-0/+2
| | | | | | | | | | | | | | | serializes out the diagnostics for a given translation unit to a bit code file. This is a WIP. The motivation for this new DiagnosticConsumer is to provide a way for tools invoking the compiler to get its diagnostics via a libclang interface, rather than textually parsing the compiler output. This gives us flexibility to change the compiler's textual output, but have a structured data format for clients to use to get the diagnostics via a stable API. I have no tests for this, but llvm-bcanalyzer so far shows that the emitted file is well-formed. More work to follow. llvm-svn: 143259
* Make -fms-compatibility imply -fms-extensions. Fixes PR11204.Douglas Gregor2011-10-241-1/+4
| | | | llvm-svn: 142797
* Take DW_AT_comp_dir from $PWD when it's present and starts with a '/'. This isNick Lewycky2011-10-211-0/+5
| | | | | | | closer to what GCC does, except that GCC also checks that the inodes for $PWD and '.' match. llvm-svn: 142633
* Frontend: Support -iframework.Daniel Dunbar2011-10-181-0/+4
| | | | llvm-svn: 142418
* Wire up support for the controlling the extended dwarf .file directive. WithNick Lewycky2011-10-171-0/+3
| | | | | | | r142300 but not this patch, clang -S may emit .s files that assemblers other than llvm-mc can't parse. llvm-svn: 142301
* When building a module, use the macro definitions on the command lineDouglas Gregor2011-10-171-0/+17
| | | | | | | | | as part of the hash rather than ignoring them. This means we'll end up building more module variants (overall), but it allows configuration macros such as NDEBUG to work so long as they're specified via command line. More to come in this space. llvm-svn: 142187
* Frontend: Replace -nostdinc by -nostdsysteminc (which is just system includeDaniel Dunbar2011-10-111-3/+3
| | | | | | paths). The -nostdinc behavior is now -nostdsysteminc + -nobuiltininc. llvm-svn: 141691
* Revert r140009, about disabling clang's builtin in -fms-compatibility mode. Francois Pichet2011-10-101-2/+1
| | | | llvm-svn: 141577
* OpenCL: add driver/frontend support for precompiled headersPeter Collingbourne2011-10-091-0/+1
| | | | llvm-svn: 141516
* CUDA: add -fcuda-is-device flagPeter Collingbourne2011-10-061-0/+3
| | | | | | | This frontend-only flag is used by the IR generator to determine whether to filter CUDA declarations for the host or for the device. llvm-svn: 141301
* Driver & AST: Implement support for -fpack-struct and -fpack-struct= commandDaniel Dunbar2011-10-051-0/+1
| | | | | | | line options. - <rdar://problem/10120602>, PR9631 llvm-svn: 141211
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-6/+4
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* [analyzer] Add -analyzer-purge option which can take on multiple values, ↵Anna Zaks2011-09-301-3/+29
| | | | | | remove -analyzer-purge=none. (Small refactor as well: move the work of constructing AnalysisManager from the callers to the class itself.) llvm-svn: 140838
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-10/+10
| | | | llvm-svn: 140478
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Add support for CPATH and friends.Benjamin Kramer2011-09-221-27/+30
| | | | | | | | | | | | This moves the existing code for CPATH into the driver and adds the environment lookup and path splitting there. The paths are then passed down to cc1 with -I options (CPATH), added after the normal user-specified include dirs. Language specific paths are passed via -LANG-isystem and the actual filtering is performed in the frontend. I tried to match GCC's behavior as close as possible Fixes PR8971. llvm-svn: 140341
OpenPOWER on IntegriCloud