summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInvocation.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145444 91177308-0d34-0410-b5e6-96231b3b80d8
* Silence GCC warnings, RefCountedBase is meant to be default-initialized here.Benjamin Kramer2011-11-291-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145396 91177308-0d34-0410-b5e6-96231b3b80d8
* Set __OPTIMIZE_SIZE__ on -Os and -Oz. This matches gcc's behaviour on both OS XRafael Espindola2011-11-261-1/+1
| | | | | | and linux. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145142 91177308-0d34-0410-b5e6-96231b3b80d8
* implement __has_feature(address_sanitizer); also use ↵Kostya Serebryany2011-11-221-3/+3
| | | | | | LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145054 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145045 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144973 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144930 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -f[no-]address-sanitizer flagKostya Serebryany2011-11-161-0/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144800 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144736 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a -cc1-level option -fmodule-name=<name>, which will be used whenDouglas Gregor2011-11-151-0/+3
| | | | | | | building modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144680 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143917 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143801 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143798 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143733 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix various minor issues find via unreachable code warnings, fromDouglas Gregor2011-11-021-1/+2
| | | | | | | Ahmed Charles! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143569 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an option to emulate the strange Apple gcc behavior of #pragma pack.Eli Friedman2011-11-021-0/+3
| | | | | | | | <rdar://problem/10374763> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143527 91177308-0d34-0410-b5e6-96231b3b80d8
* rename getHostTriple into getDefaultTargetTriple in clangSebastian Pop2011-11-011-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143503 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143314 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143259 91177308-0d34-0410-b5e6-96231b3b80d8
* Make -fms-compatibility imply -fms-extensions. Fixes PR11204.Douglas Gregor2011-10-241-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142797 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142633 91177308-0d34-0410-b5e6-96231b3b80d8
* Frontend: Support -iframework.Daniel Dunbar2011-10-181-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142418 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142301 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142187 91177308-0d34-0410-b5e6-96231b3b80d8
* Frontend: Replace -nostdinc by -nostdsysteminc (which is just system includeDaniel Dunbar2011-10-111-3/+3
| | | | | | paths). The -nostdinc behavior is now -nostdsysteminc + -nobuiltininc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141691 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r140009, about disabling clang's builtin in -fms-compatibility mode. Francois Pichet2011-10-101-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141577 91177308-0d34-0410-b5e6-96231b3b80d8
* OpenCL: add driver/frontend support for precompiled headersPeter Collingbourne2011-10-091-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141516 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141301 91177308-0d34-0410-b5e6-96231b3b80d8
* Driver & AST: Implement support for -fpack-struct and -fpack-struct= commandDaniel Dunbar2011-10-051-0/+1
| | | | | | | line options. - <rdar://problem/10120602>, PR9631 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141211 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140957 91177308-0d34-0410-b5e6-96231b3b80d8
* [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.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140838 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-10/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140478 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140341 91177308-0d34-0410-b5e6-96231b3b80d8
* In the OpenCL mode, the AltiVec mode must be off and checks must be strictTobias Grosser2011-09-211-2/+2
| | | | | | | | | | OpenCL is different from AltiVec in the way it supports vector literals. OpenCL is strict with regards to semantic checks. For example, implicit conversions and explicit casts between vectors of different types are disallowed. Fixes PR10975. Submitted by: Anton Lokhmotov <Anton.lokhmotov@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140270 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not use builtin includes if -fms-compatibility is specified. Some MSVC ↵Francois Pichet2011-09-191-1/+2
| | | | | | header files have the same name as clang's builtins, this creates clash. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140009 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-2/+2
| | | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139987 91177308-0d34-0410-b5e6-96231b3b80d8
* As per discussion with Doug Gregor on the IRC channel, introduce a new ↵Francois Pichet2011-09-171-0/+1
| | | | | | | | | | | | | | compiler switch: -fms-compatility. Microsoft specific tweaking will now fall into 2 categories: - fms-extension: Microsoft specific extensions that should never change the meaning of an otherwise well formed code. Currently map to LangOptions::Microsoft. (To be clearer, I am planning to change the name to LangOptions::MicrosoftExt). - fms-compatibility: Really a MSVC emulation mode. Map to LangOptions::MicrosoftMode. Can change the meaning of an otherwise standard conformant program. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139978 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an experimental flag -fauto-module-import that automatically turnsDouglas Gregor2011-09-151-0/+1
| | | | | | | | #include or #import direcctives of framework headers into module imports of the corresponding framework module. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139860 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate the unused -create-module cc1-level optionDouglas Gregor2011-09-151-3/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139827 91177308-0d34-0410-b5e6-96231b3b80d8
* Encode the module hash in base-36, to reduce the length of the strings a bitDouglas Gregor2011-09-141-2/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139696 91177308-0d34-0410-b5e6-96231b3b80d8
* For modules, use a hash of the compiler version, language options, andDouglas Gregor2011-09-131-0/+82
| | | | | | | | | | target triple to separate modules built under different conditions. The hash is used to create a subdirectory in the module cache path where other invocations of the compiler (with the same version, language options, etc.) can find the precompiled modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139662 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-10/+10
| | | | | | | | | | | | language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139605 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a cc1-level option to provide the path to the module cache,Douglas Gregor2011-09-121-2/+7
| | | | | | | | | where the compiler will look for module files. Eliminates the egregious hack where we looked into the header search paths for modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139538 91177308-0d34-0410-b5e6-96231b3b80d8
* Treat the weak export of block runtime symbols as a deployment-targetJohn McCall2011-09-091-0/+3
| | | | | | | | | | feature akin to the ARC runtime checks. Removes a terrible hack where IR gen needed to find the declarations of those symbols in the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139404 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the -import-module option. It's no longer usefulDouglas Gregor2011-08-271-15/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138681 91177308-0d34-0410-b5e6-96231b3b80d8
* [driver] Add -mglobal-merge/-mno-global-merge machine options to ↵Chad Rosier2011-08-261-0/+3
| | | | | | | | | enable/disable merging of globals during codegen. Fixes <rdar://problem/10017909>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138612 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate the -chained-pch flag and all of the frontend and libclang options ↵Douglas Gregor2011-08-251-3/+0
| | | | | | associated with it. Chained PCH is the only way to build a PCH file that includes another PCH file git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138597 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a -cc1 option "-emit-module", that creates a binary moduleDouglas Gregor2011-08-251-0/+3
| | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138595 91177308-0d34-0410-b5e6-96231b3b80d8
* Accept -x objc++-cpp-output as an alias for -x objective-c++-cpp-outputNico Weber2011-08-131-0/+1
| | | | | | | | | This is the ObjC++ version of r129201. It's for example needed to use ccache with clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137560 91177308-0d34-0410-b5e6-96231b3b80d8