summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
Commit message (Collapse)AuthorAgeFilesLines
* Driver: begin threading frontend support for SymbolRewriterSaleem Abdulrasool2015-01-091-0/+2
| | | | | | | | | | Allow blessed access to the symbol rewriter from the driver. Although the symbol rewriter could be invoked through tools like opt and llc, it would not accessible from the frontend. This allows us to read the rewrite map files in the frontend rather than the backend and enable symbol rewriting for actually performing the symbol interpositioning. llvm-svn: 225504
* Frontend: Fix SourceColumnMap assertion failure on non-ascii characters.Logan Chien2015-01-081-9/+11
| | | | | | | | | | | | | | | | | | | | If there are some non-ascii character in the input source code, the column index might be smallar than the byte index. This will result in two possible assertion failures. This CL fixes the computation of the column index and byte index. 1. The assertion in startOfNextColumn() and startOfPreviousColumn() should not be raised when the byte index is greater than the column index since the non-ascii characters may use more than one bytes to store a character in a column. 2. The length of the caret line should be equal to the number of columns of source line, instead of the length of the source line. Otherwise, the assertion in selectInterestingSourceRegion will be raised because the removed columns plus the kept columns are not greater than the max column, which means that we should not remove any column at all. llvm-svn: 225442
* Fix use-after-destruction introduced in r224924.Alexey Samsonov2014-12-291-1/+2
| | | | | | | | getMainExecutable() returns a std::string, assigning its result to StringRef immediately creates a dangling pointer. This was detected by half-broken fast-MSan-bootstrap bot. llvm-svn: 224956
* [multilib] Teach Clang's code about multilib by threadingChandler Carruth2014-12-291-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a CLANG_LIBDIR_SUFFIX down from the build system and using that as part of the default resource dir computation. Without this, essentially nothing that uses the clang driver works when building clang with a libdir suffix. This is probably the single biggest missing piece of support for multilib as without this people could hack clang to end up installed in the correct location, but it would then fail to find its own basic resources. I know of at least one distro that has some variation on this patch to hack around this; hopefully they'll be able to use the libdir suffix functionality directly as the rest of these bits land. This required fixing a copy of the code to compute Clang's resource directory that is buried inside of the frontend (!!!). It had bitrotted significantly relative to the driver code. I've made it essentially a clone of the driver code in order to keep tests (which use cc1 heavily) passing. This copy should probably just be removed and the frontend taught to always rely on an explicit resource directory from the driver, but that is a much more invasive change for another day. I've also updated one test which actually encoded the resource directory in its checked output to tolerate multilib suffixes. Note that this relies on a prior LLVM commit to add a stub to the autoconf build system for this variable. llvm-svn: 224924
* Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber2014-12-231-2/+2
| | | | | | | | | | | | | | | | | -trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
* Disable trigraphs in microsoft mode by default. Matches cl.exe.Nico Weber2014-12-221-9/+9
| | | | | | | | | | The default value of Opts.Trigraphs now no longer depends solely on the language input kind, so move the code out of setLangDefaults(). Also make sure that Opts.MSVCCompat is set before the Trigraph code runs. Related to PR21974. llvm-svn: 224719
* Frontend: Fix typo in comments.Logan Chien2014-12-201-2/+2
| | | | llvm-svn: 224680
* Fix handling of invalid -O options.Rafael Espindola2014-12-161-4/+6
| | | | | | | | We were checking the value after truncating it to a bitfield. Thanks to Yunzhong Gao for noticing it. llvm-svn: 224378
* Add a new flag, -fspell-checking-limit=<number> to control how many times ↵Nick Lewycky2014-12-161-0/+3
| | | | | | | | we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp. Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires. llvm-svn: 224375
* Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.Alexey Bataev2014-12-162-6/+6
| | | | | | | Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
* [OPENMP] Bugfix for processing of global variables in OpenMP regions.Alexey Bataev2014-12-162-28/+22
| | | | | | | | Currently, if global variable is marked as a private OpenMP variable, the compiler crashes in debug version or generates incorrect code in release version. It happens because in the OpenMP region the original global variable is used instead of the generated private copy. It happens because currently globals variables are not captured in the OpenMP region. This patch adds capturing of global variables iff private copy of the global variable must be used in the OpenMP region. Differential Revision: http://reviews.llvm.org/D6259 llvm-svn: 224323
* Frontend: Canonicalize to native paths when dumping module dependenciesJustin Bogner2014-12-121-0/+4
| | | | | | | | | | | | Mixed path separators (ie, both / and \\) can mess up the sort order of the VFS map when dumping module dependencies, as was recently exposed by r224055 and papered over in r224145. Instead, we should simply use native paths for consistency. This also adds a TODO to add handling of .. in paths. There was some code for this before r224055, but it was untested and probably broken. llvm-svn: 224164
* [modules] When constructing paths relative to a module, strip out /./ directoryRichard Smith2014-12-111-28/+1
| | | | | | | components. These sometimes get synthetically added, and we don't want -Ifoo and -I./foo to be treated fundamentally differently here. llvm-svn: 224055
* OpenCL C: Add support for a set of floating point Pekka Jaaskelainen2014-12-101-4/+9
| | | | | | | | | | | | | | arithmetic relaxation flags: -cl-no-signed-zeros -cl-unsafe-math-optimizations -cl-finite-math-only -cl-fast-relaxed-math Propagate the info to FP instruction flags as well as function attributes where they are available. llvm-svn: 223928
* [mips] Removing __SIZEOF_INT128__ macro for MIPS64Simon Atanasyan2014-12-101-1/+6
| | | | | | | | | | | | | This is a temporary workaround while MIPS64 has not yet fully supported 128-bit integers. But declaration of int128 type is necessary even though `__SIZEOF_INT128__` is undefined because c++ standard header files like `limits` throw error message if `__int128` is not available. Patch by Sagar Thakur. Differential Revision: http://reviews.llvm.org/D6402 llvm-svn: 223927
* Reinstate r223753, reverted in r223759 due to breakage of clang-tools-extra.Richard Smith2014-12-101-0/+1
| | | | | | | | | | | | | | | | | Original commit message: [modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1. For files named by -fmodule-map-file=, and files found by 'extern module' directives, this flag specifies that we should resolve filenames relative to the current working directory rather than relative to the directory in which the module map file resides. This is aimed at fixing path handling, in particular for relative -I paths, when building modules that represent components of the current project (rather than libraries installed on the current system, which the current project has as dependencies, where we'd typically expect the module map files to be looked up implicitly). llvm-svn: 223913
* Revert "[modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1."Duncan P. N. Exon Smith2014-12-091-1/+0
| | | | | | | | | | | | | This reverts commit r223753. It broke the Green Dragon build for a few hours: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/ http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/consoleFull#43901905849ba4694-19c4-4d7e-bec5-911270d8a58c I suspect `clang-tools-extra` just needs a follow-up for an API change, but I'm not the right one to look into it. llvm-svn: 223759
* [modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1.Richard Smith2014-12-091-0/+1
| | | | | | | | | | | | | For files named by -fmodule-map-file=, and files found by 'extern module' directives, this flag specifies that we should resolve filenames relative to the current working directory rather than relative to the directory in which the module map file resides. This is aimed at fixing path handling, in particular for relative -I paths, when building modules that represent components of the current project (rather than libraries installed on the current system, which the current project has as dependencies, where we'd typically expect the module map files to be looked up implicitly). llvm-svn: 223753
* [modules] If the same .pcm file is imported via two different paths, don'tRichard Smith2014-12-091-1/+3
| | | | | | complain that the contained modules are defined twice. llvm-svn: 223724
* PR21217: Slightly more eagerly load -fmodule-map-file= files and provideRichard Smith2014-12-062-3/+9
| | | | | | diagnostics if they don't exist. Based on a patch by John Thompson! llvm-svn: 223561
* Use isOSBinFormatMachO() instead of comparing the object formatEric Christopher2014-12-051-1/+1
| | | | | | against an enum. llvm-svn: 223422
* CUDA host device code with two code pathsReid Kleckner2014-12-032-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Summary: Allow CUDA host device functions with two code paths using __CUDA_ARCH__ to differentiate between code path being compiled. For example: __host__ __device__ void host_device_function(void) { #ifdef __CUDA_ARCH__ device_only_function(); #else host_only_function(); #endif } Patch by Jacques Pienaar. Reviewed By: rnk Differential Revision: http://reviews.llvm.org/D6457 llvm-svn: 223271
* [modules] Track how 'header' directives were written in module map files,Richard Smith2014-12-022-30/+52
| | | | | | | | | | | | | rather than trying to extract this information from the FileEntry after the fact. This has a number of beneficial effects. For instance, diagnostic messages for failed module builds give a path relative to the "module root" rather than an absolute file path, and the contents of the module includes file is no longer dependent on what files the including TU happened to inspect prior to triggering the module build. llvm-svn: 223095
* Add flag -f(no-)modules-implicit-maps.Daniel Jasper2014-11-251-0/+2
| | | | | | | This suppresses the implicit search for files called 'module.modulemap' and similar. llvm-svn: 222745
* Extended list of valid frontend options with '-cl-std=CL2.0'.Anastasia Stulova2014-11-201-2/+5
| | | | | | | This option sets language mode for the compilation of a source file to be OpenCL v2.0. Example: clang -cc1 -cl-std=CL2.0 myfile.cl llvm-svn: 222444
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-193-7/+7
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-191-5/+5
| | | | llvm-svn: 222306
* Update for LLVM API changeDavid Blaikie2014-11-191-2/+2
| | | | llvm-svn: 222303
* Make DiagnosticsEngine::takeClient return std::unique_ptr<>Alexander Kornienko2014-11-174-30/+21
| | | | | | | | | | | | | | | | | | Summary: Make DiagnosticsEngine::takeClient return std::unique_ptr<>. Updated callers to store conditional ownership using a pair of pointer and unique_ptr instead of a pointer + bool. Updated code that temporarily registers clients to use the non-owning registration (+ removed extra calls to takeClient). Reviewers: dblaikie Reviewed By: dblaikie Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6294 llvm-svn: 222193
* A small correction for r221884. No functional changes.Alexander Kornienko2014-11-171-1/+1
| | | | llvm-svn: 222130
* Add DiagID and Warning Flag to DiagnosticsLogSteven Wu2014-11-141-0/+10
| | | | llvm-svn: 222042
* Remove some redundant virtual specifiers on overriden functions.David Blaikie2014-11-141-2/+2
| | | | llvm-svn: 222024
* Remove -fseh-exceptions in favor of checking the tripleReid Kleckner2014-11-142-3/+0
| | | | | | | | | This option was misleading because it looked like it enabled the language feature of SEH (__try / __except), when this option was really controlling which EH personality function to use. Mingw only supports SEH and SjLj EH on x86_64, so we can simply do away with this flag. llvm-svn: 221963
* Support non-owned DiagnosticConsumer in SetupSerializedDiagnosticsAlexander Kornienko2014-11-131-4/+8
| | | | | | | | | | This fixes an assertion when running clang-tidy on a file having --serialize-diagnostics in compiler options. Committing a regression test for clang-tidy separately. Patch by Aaron Wishnick! llvm-svn: 221884
* Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,Richard Smith2014-11-121-0/+16
| | | | | | which we don't yet implement). llvm-svn: 221816
* Simplify code a bit by passing StreamFile to the BitstreamCursor constructor.Rafael Espindola2014-11-121-2/+1
| | | | llvm-svn: 221784
* Introduce -fsanitize-coverage=N flagKostya Serebryany2014-11-111-0/+2
| | | | | | | | | | | | | | | | | | | Summary: This change makes the asan-coverge (formerly -mllvm -asan-coverge) accessible via a clang flag. Companion patch to LLVM is http://reviews.llvm.org/D6152 Test Plan: regression tests, chromium Reviewers: samsonov Reviewed By: samsonov Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6153 llvm-svn: 221719
* [OPENMP] Codegen for threadprivate variablesAlexey Bataev2014-11-111-0/+6
| | | | | | | | | For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>); Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info. Differential Revision: http://reviews.llvm.org/D4002 llvm-svn: 221663
* [Sanitizer] Refactor sanitizer options in LangOptions.Alexey Samsonov2014-11-111-2/+2
| | | | | | | | | | | | | | | | | | Get rid of ugly SanitizerOptions class thrust into LangOptions: * Make SanitizeAddressFieldPadding a regular language option, and rely on default behavior to initialize/reset it. * Make SanitizerBlacklistFile a regular member LangOptions. * Introduce the helper class "SanitizerSet" to represent the set of enabled sanitizers and make it a member of LangOptions. It is exactly the entity we want to cache and modify in CodeGenFunction, for instance. We'd also be able to reuse SanitizerSet in CodeGenOptions for storing the set of recoverable sanitizers, and in the Driver to represent the set of sanitizers turned on/off by the commandline flags. No functionality change. llvm-svn: 221653
* Move CodeGenOptions constructor out-of-line and add missing headers. NFC.Alexey Samsonov2014-11-112-0/+25
| | | | llvm-svn: 221646
* Introduce a SanitizerKind enum to LangOptions.Alexey Samsonov2014-11-071-25/+8
| | | | | | | | | | | | | Use the bitmask to store the set of enabled sanitizers instead of a bitfield. On the negative side, it makes syntax for querying the set of enabled sanitizers a bit more clunky. On the positive side, we will be able to use SanitizerKind to eventually implement the new semantics for -fsanitize-recover= flag, that would allow us to make some sanitizers recoverable, and some non-recoverable. No functionality change. llvm-svn: 221558
* Objective-C SDK modernization tool. Use its own optionFariborz Jahanian2014-10-311-0/+2
| | | | | | | | ,-objcmt-migrate-property-dot-syntax, when migarting to use property-dot syntax in place of messaging expression. rdar://18839124 llvm-svn: 221001
* [libclang] Disable spell-checking and warnings during code-completion since ↵Argyrios Kyrtzidis2014-10-311-0/+4
| | | | | | they are not needed. llvm-svn: 220966
* [modules] When a .pcm file is explicitly built separately from the translationRichard Smith2014-10-312-4/+4
| | | | | | unit, allow the -O settings of the two compilations to differ. llvm-svn: 220943
* Objective-C modern rewriter. Patch to fix a rewriting bug Fariborz Jahanian2014-10-281-0/+4
| | | | | | | rewriting an Objective-C block. Patch by Ryan Govostes. rdar://18799145 llvm-svn: 220834
* [modules] Load .pcm files specified by -fmodule-file lazily.Richard Smith2014-10-272-53/+70
| | | | llvm-svn: 220731
* Frontend: Don't include stdin in the dependency list for an object fileDavid Majnemer2014-10-271-2/+11
| | | | | | | | | GCC doesn't do this and it semes weird to include a file that we can't open. This fixes PR21362. llvm-svn: 220726
* Frontend: Define __EXCEPTIONS if -fexceptions is passedDavid Majnemer2014-10-271-1/+1
| | | | | | | | | GCC defines __EXCEPTIONS, regardless of language mode, if -fexceptions is passed. We should do the same. This fixes PR21358. llvm-svn: 220714
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-264-14/+19
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Add a new -fmerge-functions -cc1 flag that enables function merging.Nick Lewycky2014-10-241-0/+1
| | | | llvm-svn: 220543
OpenPOWER on IntegriCloud