summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
...
* ObjectiveC migrator: Add more options one for eachFariborz Jahanian2013-10-021-0/+8
| | | | | | kind of migration. // rdar://15003157 llvm-svn: 191858
* ObjectiveC migrator. Starting distiguising differentFariborz Jahanian2013-10-021-0/+4
| | | | | | | migrations under their own option. wip and // rdar://15003157 llvm-svn: 191855
* Accept #pragma warning(push, 0) without warningReid Kleckner2013-10-021-1/+1
| | | | | | | | This partially addresses PR17435, but it doesn't actually implement the pragma. If we implement it, we should map levels 1-4 to something like -Wall and level 0 to something like -w. llvm-svn: 191833
* Revert r191586 and r191695. They cause crashes when building withRichard Smith2013-10-011-1/+1
| | | | | | -relaxed-aliasing. llvm-svn: 191725
* Turn struct-path aware TBAA on by default.Manman Ren2013-09-301-1/+1
| | | | | | Use -no-struct-path-tbaa to turn it off. llvm-svn: 191695
* Add character set related __STDC_* definitions.Ed Schouten2013-09-291-0/+8
| | | | | | | | | | | | | Clang uses UTF-16 and UTF-32 for its char16_t's and char32_t's exclusively. This means that we can define __STDC_UTF_16__ and __STDC_UTF_32__ unconditionally. While there, define __STDC_MB_MIGHT_NEQ_WC__ for FreeBSD. FreeBSD's wchar_t's don't encode characters as ISO-10646; the encoding depends on the locale used. Because the character set used might not be a superset of ASCII, we must define __STDC_MB_MIGHT_NEQ_WC__. llvm-svn: 191631
* Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;Richard Smith2013-09-291-0/+1
| | | | | | | instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out the backward-compatibility issues. llvm-svn: 191629
* Replace -fobjc-default-synthesize-properties with ↵Rafael Espindola2013-09-271-1/+1
| | | | | | | | | disable-objc-default-synthesize-properties. We want the modern behavior most of the time, so inverting the option simplifies the driver and the tests. llvm-svn: 191551
* Add -fmodule-map-file option.Daniel Jasper2013-09-241-0/+3
| | | | | | | | | | | | | | | With this option, arbitrarily named module map files can be specified to be loaded as required for headers in the respective (sub)directories. This, together with the extern module declaration allows for specifying module maps in a modular fashion without the need for files called "module.map". Among other things, this allows a directory to contain two modules that are completely independent of one another. Review: http://llvm-reviews.chandlerc.com/D1697. llvm-svn: 191284
* Module use declarations (II)Daniel Jasper2013-09-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Review: http://llvm-reviews.chandlerc.com/D1546. I have picked up this patch form Lawrence (http://llvm-reviews.chandlerc.com/D1063) and did a few changes. From the original change description (updated as appropriate): This patch adds a check that ensures that modules only use modules they have so declared. To this end, it adds a statement on intended module use to the module.map grammar: use module-id A module can then only use headers from other modules if it 'uses' them. This enforcement is off by default, but may be turned on with the new option -fmodules-decluse. When enforcing the module semantics, we also need to consider a source file part of a module. This is achieved with a compiler option -fmodule-name=<module-id>. The compiler at present only applies restrictions to the module directly being built. llvm-svn: 191283
* clang-cl: print diagnostics as "error(clang): foo" in /fallback modeHans Wennborg2013-09-243-8/+23
| | | | | | | | | | | | | | | This solves two problems: 1) MSBuild will not flag the build as unsuccessful just because we print an error in the output, since "error(clang):" doesn't seem to match the regex it's using. 2) It becomes more clear that the diagnostic is coming from clang as supposed to cl.exe. Differential Revision: http://llvm-reviews.chandlerc.com/D1735 llvm-svn: 191250
* Fix array_pod_sort predicates after LLVM change.Benjamin Kramer2013-09-221-3/+1
| | | | llvm-svn: 191176
* Make Preprocessor::Lex non-recursive.Eli Friedman2013-09-191-1/+1
| | | | | | | | | | | | | | | Before this patch, Lex() would recurse whenever the current lexer changed (e.g. upon entry into a macro). This patch turns the recursion into a loop: the various lex routines now don't return a token when the current lexer changes, and at the top level Preprocessor::Lex() now loops until it finds a token. Normally, the recursion wouldn't end up being very deep, but the recursion depth can explode in edge cases like a bunch of consecutive macros which expand to nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this patch). <rdar://problem/14569770> llvm-svn: 190980
* Fix potential race in module building code.Eli Friedman2013-09-171-8/+2
| | | | | | | | | Let the module building code handle the case of overwriting an existing file itself, so the existing locking infrastructure works correctly. <rdar://problem/14403381> llvm-svn: 190833
* Add a define for the ObjFW runtime ABI version.Benjamin Kramer2013-09-161-0/+16
| | | | | | | | | This removes __has_feature(objc_msg_lookup_stret), as it is not required anymore after this patch. Patch by Jonathan Schleifer! llvm-svn: 190791
* Lex and ignore Microsoft's #pragma warning(...)Reid Kleckner2013-09-131-0/+34
| | | | | | | | | | | | | | | | | Summary: This fixes PR17145 and avoids unknown pragma warnings. This change does not attempt to map MSVC warning numbers to clang warning flags. Perhaps in the future we will implement a mapping for some common subset of Microsoft warnings, but for now we don't. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1652 llvm-svn: 190726
* Remove unnecessary inclusion of Sema.hDavid Blaikie2013-09-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let me tell you a tale... Within some twisted maze of debug info I've ended up implementing an insane man's Include What You Use device. When the debugger emits debug info it really shouldn't, I find out why & then realize the code could be improved too. In this instance CIndexDiagnostics.cpp had a lot more debug info with Clang than GCC. Upon inspection a major culprit was all the debug info describing clang::Sema. This was emitted because clang::Sema is befriended by DiagnosticEngine which was rightly required, but GCC doesn't emit debug info for friends so it never emitted anything for Clang. Clang does emit debug info for friends (will be fixed/changed to reduce debug info size). But why didn't Clang just emit a declaration of Sema if this entire TU didn't require a definition? 1) Diagnostic.h did the right thing, only using a declaration of Sema and not including Sema.h at all. 2) Some other dependency of CIndexDiagnostics.cpp didn't do the right thing. ASTUnit.h, only needing a declaration, still included Sema.h (hence this commit which removes that include and adds the necessary includes to the cpp files that were relying on this) 3) -flimit-debug-info didn't save us because of EnterExpressionEvaluationContext, defined inline in Sema.h which fires the "requiresCompleteType" check/flag (since it uses nested types from Sema and calls Sema member functions) and thus, if debug info is ever emitted for the type, the whole type is emitted and not just a declaration. Improving -flimit-debug-info to account for this would be... hard. Modifying the code so that's not 'required to be complete' might be possible, but probably only by moving EnterExpressionEvaluationContext either into Sema, or out of Sema.h. That might be a bit too much of a contortion to be bothered with. Also, this is only one of the cases where emitting debug info for friends caused us to emit a lot more debug info (this change reduces Clang's DWO size by 0.93%, dropping friends entirely reduces debug info by 3.2%) - I haven't hunted down the other cases, but I assume they might be similar (Sema or something like it). IWYU or a similar tool might help us reduce build times a bit, but analyzing debug info to find these differences isn't worthwhile. I'll take the 3.2% win, provide this small improvement to the code itself, and move on. llvm-svn: 190715
* Certain multi-platform languages, such as OpenCL, have the concept ofDavid Tweed2013-09-131-0/+22
| | | | | | | | | | | | | | address spaces which is both (1) a "semantic" concept and (2) possibly a hardware level restriction. It is desirable to be able to discard/merge the LLVM-level address spaces on arguments for which there is no difference to the current backend while keeping track of the semantic address spaces in a funciton prototype. To do this enable addition of the address space into the name-mangling process. Add some tests to document this behaviour against inadvertent changes. Patch by Michele Scandale! llvm-svn: 190684
* Move Compilation::PrintJob and PrintDiagnosticJob into Job::Print.Hans Wennborg2013-09-121-2/+2
| | | | | | | | | | | | | | | | | This moves the code to Job.cpp, which seems like a more natural fit, and replaces the "is this a JobList? is this a Command?" logic with a virtual function call. It also removes the code duplication between PrintJob and PrintDiagnosticJob and simplifies the code a little. There's no functionality change here, except that the Executable is now always printed within quotes, whereas it would previously not be quoted in crash reports, which I think was a bug. Differential Revision: http://llvm-reviews.chandlerc.com/D1653 llvm-svn: 190620
* Add -fansi-escape-codes optionNico Rieck2013-09-111-0/+3
| | | | | | | | | | | | | Some build systems use pipes for stdin/stderr. On nix-ish platforms colored output can be forced by -fcolor-diagnostics. On Windows this option has no effect in these cases because LLVM uses the console API (which only operates on the console buffer) even if a console wrapper capable of interpreting ANSI escape codes is used. The -fansi-escape-codes option allows switching from the console API to ANSI escape codes. It has no effect on other platforms. llvm-svn: 190464
* The OpenCL standard specifies the sizes and alignments of various types than ↵David Tweed2013-09-091-2/+2
| | | | | | | | | | | other C-family languages, as well as specifying errno is not set by the math functions. Make the clang front-end set those appropriately when the OpenCL language option is set. Patch by Erik Schnetter! llvm-svn: 190296
* Add new methods for TargetInfo:Stepan Dyatkovskiy2013-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth. As first commit for PR16752 fix: 'mode' attribute for unusual targets doesn't work properly Description: Troubles could be happened due to some assumptions in handleModeAttr function (see SemaDeclAttr.cpp). For example, it assumes that 32 bit integer is 'int', while it could be 16 bit only. Instead of asking target: 'which type do you want to use for int32_t ?' it just hardcodes general opinion. That doesn't looks pretty correct. Please consider the next solution: 1. In Basic/TargetInfo add getIntTypeByWidth and getRealTypeByWidth virtual methods. By default current behaviour could be implemented here. 2. Fix handleModeAttr according to new methods in TargetInfo. This approach is implemented in the patch attached to this post. Fixes: 1st Commit (Current): Add new methods for TargetInfo: getRealTypeByWidth and getIntTypeByWidth for ASTContext names are almost same(invokes new methods from TargetInfo): getIntTypeForBitwidth and getRealTypeForBitwidth 2nd Commit (Next): Fix SemaDeclAttr, handleModeAttr function. llvm-svn: 190044
* Note when a decl is used in AST files.Eli Friedman2013-09-051-0/+6
| | | | | | | | | | | | | | | When an AST file is built based on another AST file, it can use a decl from the fist file, and therefore mark the "isUsed" bit. We need to note this in the AST file so that the bit is set correctly when the second AST file is loaded. This patch introduces the distinction between setIsUsed() and markUsed() so that we don't call into the ASTMutationListener callback when it wouldn't be appropriate. Fixes PR16635. llvm-svn: 190016
* Attempt to migrate default dwarf version to 4 for linux.Eric Christopher2013-09-031-2/+2
| | | | llvm-svn: 189823
* Properly escape filenames in line directives.Eli Friedman2013-08-291-3/+2
| | | | | | | Fixes PR17018. Only partial test coverage because I don't want to try to write a test which generates a file whose name contains a newline. llvm-svn: 189557
* ObjectiveC migrator. This patch infers readonly properties for no-parameter Fariborz Jahanian2013-08-281-0/+2
| | | | | | | instance methods returning non-void. This will be quite noisy. So, it is placed under a new migrator flag -objcmt-migrate-readonly-property. llvm-svn: 189537
* Handle -D arguments ending in a backslash.Eli Friedman2013-08-281-1/+14
| | | | | | | | | | We translate these into #define directives; to preserve gcc-compatible semantics (where the expanded macro includes the backslash), we add an extra "\\\n" to the end of the synthesized "#define". <rdar://problem/14810220> llvm-svn: 189511
* This wasn't headers, just missing namespaces.Benjamin Kramer2013-08-241-4/+4
| | | | | | /me bows head in shame. llvm-svn: 189172
* Replace compLocDecl with less_first.Benjamin Kramer2013-08-241-14/+8
| | | | llvm-svn: 189170
* Split isFromMainFile into two functions.Eli Friedman2013-08-221-2/+2
| | | | | | | | | Basically, isInMainFile considers line markers, and isWrittenInMainFile doesn't. Distinguishing between the two is useful when dealing with files which are preprocessed files or rewritten with -frewrite-includes (so we don't, for example, print useless warnings). llvm-svn: 188968
* Move -mfpmath handling to -cc1 and implement it for x86.Rafael Espindola2013-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The original idea was to implement it all on the driver, but to do that the driver needs to know the sse level and to do that it has to know the default features of a cpu. Benjamin Kramer pointed out that if one day we decide to implement support for ' __attribute__ ((__target__ ("arch=core2")))', then the frontend needs to keep its knowledge of default features of a cpu. To avoid duplicating which part of clang handles default cpu features, it is probably better to handle -mfpmath in the frontend. For ARM this patch is just a small improvement. Instead of a cpu list, we check if neon is enabled, which allows us to reject things like -mcpu=cortex-a9 -mfpu=vfp -mfpmath=neon For X86, since LLVM doesn't support an independent ssefp feature, we just make sure the selected -mfpmath matches the sse level. llvm-svn: 188939
* InitHeaderSearch.cpp: [Cygwin] Add 4.7.3.NAKAMURA Takumi2013-08-181-0/+1
| | | | llvm-svn: 188638
* [analyzer] Merge TextPathDiagnostics and ClangDiagPathDiagConsumer.Jordan Rose2013-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | This once again restores notes to following their associated warnings in -analyzer-output=text mode. (This is still only intended for use as a debugging aid.) One twist is that the warning locations in "regular" analysis output modes (plist, multi-file-plist, html, and plist-html) are reported at a different location on the command line than in the output file, since the command line has no path context. This commit makes -analyzer-output=text behave like a normal output format, which means that the *command line output will be different* in -analyzer-text mode. Again, since -analyzer-text is a debugging aid and lo-fi stand-in for a regular output mode, this change makes sense. Along the way, remove a few pieces of stale code related to the path diagnostic consumers. llvm-svn: 188514
* SourceManager intialization tweaks.Benjamin Kramer2013-08-121-13/+14
| | | | | | | | | | - Open files before calling stat on them. - Go through FileManager for getting the buffer of named pipes. It has the necessary plumbing to deal with "volatile" files. - Print the cause when stdin reading fails. The only case I can imagine where this happens is when stdin is wired to a device file, so no test case. llvm-svn: 188178
* clang-cl: Support /showIncludesHans Wennborg2013-08-093-8/+22
| | | | | | | | | | This option prints information about #included files to stderr. Clang could already do it, this patch just teaches the existing code about the /showIncludes style and adds the flag. Differential Revision: http://llvm-reviews.chandlerc.com/D1333 llvm-svn: 188037
* The only useful loop unrolling flag to give realistically isChandler Carruth2013-08-081-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | '-fno-unroll-loops'. The option to the backend is even called 'DisableUnrollLoops'. This is precisely the form that Clang *didn't* support. We didn't recognize the flag, we didn't pass it to the CC1 layer, and even if we did we wouldn't use it. Clang only inspected the positive form of the flag, and only did so to enable loop unrolling when the optimization level wasn't high enough. This only occurs for an optimization level that even has a chance of running the loop unroller when optimizing for size. This commit wires up the 'no' variant, and switches the code to actually follow the standard flag pattern of using the last flag and allowing a flag in either direction to override the default. I think this is still wrong. I don't know why we disable the loop unroller entirely *from Clang* when optimizing for size, as the loop unrolling pass *already has special logic* for the case where the function is attributed as optimized for size! We should really be trusting that. Maybe in a follow-up patch, I don't really want to change behavior here. llvm-svn: 187969
* clang-cl: Support the run-time selection options (/MD, /MT et al.)Hans Wennborg2013-08-081-0/+2
| | | | | | | | | | | | These flags set some preprocessor macros and injects a dependency on the runtime library into the object file, which later is picked up by the linker. This also adds a new CC1 flag for adding a dependent library. Differential Revision: http://llvm-reviews.chandlerc.com/D1315 llvm-svn: 187945
* [PCH] Fix a PCH serialization crash, with invalid code related to forward ↵Argyrios Kyrtzidis2013-08-071-3/+7
| | | | | | | | | | | | | | | | enum references. The problem was that an enum without closing semicolon could be associated as a forward enum in an erroneous declaration, leading to the identifier being associated with the enum decl but without a declaration actually referencing it. This resulted in not having it serialized before serializing the identifier that is associated with. Also prevent the ASTUnit from querying the serialized DeclID for an invalid top-level decl; it may not have been serialized. rdar://14539667 llvm-svn: 187914
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-0/+8
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Add option to disable module loading.Daniel Jasper2013-08-051-0/+2
| | | | | | | This patch was created by Lawrence Crowl and reviewed in: http://llvm-reviews.chandlerc.com/D963 llvm-svn: 187738
* CC1: Only parse command-line options that have the CC1Option flag.Hans Wennborg2013-08-021-12/+3
| | | | | | | | | | | | | We already reject flags that don't have the CC1Option flag, but we would previously do so after parsing the command-line arguments. Since the option parser now has a parameter for excluding options, we should just use that instead. Differential Revision: http://llvm-reviews.chandlerc.com/D1270 llvm-svn: 187668
* Use llvm::sys::fs::UniqueID for windows and unix.Rafael Espindola2013-08-012-27/+23
| | | | | | | | | | | | | | | | | | | This unifies the unix and windows versions of FileManager::UniqueDirContainer and FileManager::UniqueFileContainer by using UniqueID. We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we want to be able to construct fake ones, and file_status has different members on unix and windows. What the patch does is: * Record only the information that clang is actually using. * Use llvm::sys::fs::status instead of stat and fstat. * Use llvm::sys::fs::UniqueID * Delete the old windows versions of UniqueDirContainer and UniqueFileContainer since the "unix" one now works on windows too. llvm-svn: 187619
* Update for llvm api change.Rafael Espindola2013-07-291-5/+5
| | | | llvm-svn: 187379
* Convert a use of stat with sys::fs::status.Rafael Espindola2013-07-291-9/+10
| | | | llvm-svn: 187364
* Avoid crashing if a directory has no pch files.Rafael Espindola2013-07-281-0/+2
| | | | | | Should fix some of the bots that have assertions disabled. llvm-svn: 187329
* Add a -fno-math-builtin option to the Clang -cc1Eli Bendersky2013-07-231-0/+1
| | | | llvm-svn: 186899
* Fix crash in libclang if code completion is used with unknown flags.Manuel Klimek2013-07-181-1/+1
| | | | | | | Use CaptureDroppedDiagnostics to make sure that there is a diagnostic client installed when warning flags are parsed. llvm-svn: 186582
* Use the simpler is_directory.Rafael Espindola2013-07-171-2/+1
| | | | llvm-svn: 186487
* Update for llvm API change.Rafael Espindola2013-07-162-9/+9
| | | | llvm-svn: 186448
* ObjC migrator: Add -objcmt-migrate-property to do propertyFariborz Jahanian2013-07-091-0/+2
| | | | | | | migration. Also, fixes an old bug where older migration flags were not being checked for properly. llvm-svn: 185948
OpenPOWER on IntegriCloud