aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
AgeCommit message (Collapse)AuthorFilesLines
2012-01-29Complain about attempts to use 'protected' visibility on targetsJohn McCall1-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
2012-01-26objc-arc: introduce -no-finalize-removal which in gc mode,Fariborz Jahanian1-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
2012-01-26Extend the ExternalASTSource interface to allow the AST source toDouglas Gregor1-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
2012-01-26Introduce 3 new fixit options:Argyrios Kyrtzidis1-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
2012-01-25arc migrator: Provide infrastructure to add optionsFariborz Jahanian1-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
2012-01-23Add support for -fno-optimize-sibling-calls. Currently only implemented in theNick Lewycky1-0/+3
X86 backend in LLVM. llvm-svn: 148689
2012-01-20More dead code removal (using -Wunreachable-code)David Blaikie1-2/+0
llvm-svn: 148577
2012-01-20Extract the (InputKind, std::string) pair used to describe inputs toDouglas Gregor1-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
2012-01-03Add a "Modules" language option, which subsumes the previousDouglas Gregor1-1/+3
"AutoModuleImport" preprocessor option and is tied to -fmodules. llvm-svn: 147448
2012-01-03Rename the command-line option for mapping #include/#import over toDouglas Gregor1-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
2012-01-02Fix PR11685 by implementing -ffast-math and its various friends in theChandler Carruth1-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
2011-12-23Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" ↵Benjamin Kramer1-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
2011-12-23Let CompilerInvocation initialization indicate failureDylan Noblesmith1-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
2011-12-16C++11 constexpr: Add note stacks containing backtraces if constant evaluationRichard Smith1-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
2011-12-14Per discussion on the list, remove BitcodeVerify pass to reimplement as a ↵Chad Rosier1-3/+0
free function. llvm-svn: 146530
2011-12-12Add frontend flags to enable bitcode verifier pass.Chad Rosier1-0/+3
llvm-svn: 146441
2011-12-12Hexagon backend supportTony Linthicum1-0/+1
llvm-svn: 146413
2011-12-09Driver: Handle -f{no-}honor-infinities, -f{no-}honor-nans, andDaniel Dunbar1-2/+10
-ffinite-math-only. - No test case yet, I don't know how to construct a situation where this matters. llvm-svn: 146297
2011-12-06Stack realignment is a tristate. Add -mno-stackrealign to turn off all stackNick Lewycky1-1/+1
realignment, even with locals with alignment exceeding the ABI guarantee. llvm-svn: 145909
2011-12-05Add -mstack-alignment=X and fix -mstackrealign handling now that theJoerg Sonnenberger1-0/+5
backend options are gone. llvm-svn: 145868
2011-11-29Eliminate the -emit-module option, which emitted a module by parsing aDouglas Gregor1-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
2011-11-29Silence GCC warnings, RefCountedBase is meant to be default-initialized here.Benjamin Kramer1-1/+2
llvm-svn: 145396
2011-11-26Set __OPTIMIZE_SIZE__ on -Os and -Oz. This matches gcc's behaviour on both OS XRafael Espindola1-1/+1
and linux. llvm-svn: 145142
2011-11-22implement __has_feature(address_sanitizer); also use ↵Kostya Serebryany1-3/+3
LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer llvm-svn: 145054
2011-11-21Add driver arguments -ftemplate-depth=N and -fconstexpr-depth=N, with the sameRichard Smith1-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
2011-11-18Refine placement of LangOptions object in CompilerInvocation by adding a new ↵Ted Kremenek1-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
2011-11-17Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted ↵Ted Kremenek1-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
2011-11-16Add -f[no-]address-sanitizer flagKostya Serebryany1-0/+3
llvm-svn: 144800
2011-11-16Add support for building a module from a module map to the -cc1Douglas Gregor1-0/+3
interface. This is currently limited to modules with umbrella headers. llvm-svn: 144736
2011-11-15Add a -cc1-level option -fmodule-name=<name>, which will be used whenDouglas Gregor1-0/+3
building modules. llvm-svn: 144680
2011-11-07Rip out one of the features I added for the driver-include-management.Chandler Carruth1-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
2011-11-05Fix a significant oversight in my move of MSVC includes to the driver:Chandler Carruth1-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
2011-11-05Add two flags to the CC1 layer that I was hoping to avoid. We need toChandler Carruth1-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
2011-11-04Enable -flimit-debug-info by default. Now, clang lazily emits debug info for ↵Devang Patel1-1/+2
structs. Original behavior can be restored using -fno-limit-debug-info. llvm-svn: 143733
2011-11-02Fix various minor issues find via unreachable code warnings, fromDouglas Gregor1-1/+2
Ahmed Charles! llvm-svn: 143569
2011-11-02Add an option to emulate the strange Apple gcc behavior of #pragma pack.Eli Friedman1-0/+3
<rdar://problem/10374763> llvm-svn: 143527
2011-11-01rename getHostTriple into getDefaultTargetTriple in clangSebastian Pop1-2/+2
llvm-svn: 143503
2011-10-30Add support for lazily linking bitcode files (using a newPeter Collingbourne1-0/+1
-mlink-bitcode-file flag), and more generally llvm::Modules, before running optimisations. llvm-svn: 143314
2011-10-29Start work on SerializedDiagnosticPrinter, a new DiagnosticConsumer that ↵Ted Kremenek1-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
2011-10-24Make -fms-compatibility imply -fms-extensions. Fixes PR11204.Douglas Gregor1-1/+4
llvm-svn: 142797
2011-10-21Take DW_AT_comp_dir from $PWD when it's present and starts with a '/'. This isNick Lewycky1-0/+5
closer to what GCC does, except that GCC also checks that the inodes for $PWD and '.' match. llvm-svn: 142633
2011-10-18Frontend: Support -iframework.Daniel Dunbar1-0/+4
llvm-svn: 142418
2011-10-17Wire up support for the controlling the extended dwarf .file directive. WithNick Lewycky1-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
2011-10-17When building a module, use the macro definitions on the command lineDouglas Gregor1-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
2011-10-11Frontend: Replace -nostdinc by -nostdsysteminc (which is just system includeDaniel Dunbar1-3/+3
paths). The -nostdinc behavior is now -nostdsysteminc + -nobuiltininc. llvm-svn: 141691
2011-10-10Revert r140009, about disabling clang's builtin in -fms-compatibility mode. Francois Pichet1-2/+1
llvm-svn: 141577
2011-10-09OpenCL: add driver/frontend support for precompiled headersPeter Collingbourne1-0/+1
llvm-svn: 141516
2011-10-06CUDA: add -fcuda-is-device flagPeter Collingbourne1-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
2011-10-05Driver & AST: Implement support for -fpack-struct and -fpack-struct= commandDaniel Dunbar1-0/+1
line options. - <rdar://problem/10120602>, PR9631 llvm-svn: 141211
2011-10-02Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall1-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