summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Revisit PR10177: don't instantiate a variable if it's only referenced in aRichard Smith2017-01-062-63/+51
| | | | | | | | | | | | | | dependent context and can't be used in a constant expression. Per C++ [temp.inst]p2, "the instantiation of a static data member does not occur unless the static data member is used in a way that requires the definition to exist". This doesn't /quite/ match that, as we still instantiate static data members that are usable in constant expressions even if the use doesn't require a definition. A followup patch will fix that for both variables and functions. llvm-svn: 291295
* Use CodegenOpts::less when creating a TargetMachine for clang `-O1`Mehdi Amini2017-01-061-4/+15
| | | | | | | | | | | | | | | | | | | Summary: Clang was initializing the TargetMachine with CodeGenOpt::Default for O1. This change is aligning it on llc: -O0: OptLevel = CodeGenOpt::None -O1: OptLevel = CodeGenOpt::Less -O2 -Os -Oz: OptLevel = CodeGenOpt::Default -O3: OptLevel = CodeGenOpt::Aggressive Reviewers: echristo, chandlerc Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28409 llvm-svn: 291276
* Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase ↵David Blaikie2017-01-068-64/+60
| | | | | | | | | | | | | | and CodeCompleteConsumer" Aleksey Shlypanikov pointed out my mistake in migrating an explicit unique_ptr to auto - I was expecting the function returned a unique_ptr, but instead it returned a raw pointer - introducing a leak. Thanks Aleksey! This reapplies r291184, reverted in r291249. llvm-svn: 291270
* Clean up redundant isa<T> before getAs<T>. NFC.George Burgess IV2017-01-061-4/+2
| | | | llvm-svn: 291264
* Make ASTContext::getDeclAlign return the correct alignment forAkira Hatanaka2017-01-061-1/+3
| | | | | | | | | | | | | | | | | | | FunctionDecls. This commit silences an incorrect warning that is issued when a function pointer is cast to another function pointer type. The warning gets issued because alignments of the source and destination do not match in Sema::CheckCastAlign, which happens because ASTContext::getTypeInfoImpl and ASTContext::getDeclAlign return different values for functions (the former returns 4 while the latter returns 1). This should fix PR31558. rdar://problem/29533528 Differential Revision: https://reviews.llvm.org/D27478 llvm-svn: 291253
* Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and ↵David Blaikie2017-01-068-60/+64
| | | | | | | | | | CodeCompleteConsumer" Caused a memory leak reported by asan. Reverting while I investigate. This reverts commit r291184. llvm-svn: 291249
* [OpenCL] Re-enable supported core extensions based on opencl version when ↵Konstantin Zhuravlyov2017-01-061-2/+4
| | | | | | | | disabling all extensions using pragma Differential Revision: https://reviews.llvm.org/D28257 llvm-svn: 291243
* [ubsan] Minimize size of data for type_mismatch (Redo of D19667)Filipe Cabecinhas2017-01-062-6/+7
| | | | | | | | | | | | | | | | | | Summary: This patch makes the type_mismatch static data 7 bytes smaller (and it ends up being 16 bytes smaller due to alignment restrictions, at least on some x86-64 environments). It revs up the type_mismatch handler version since we're breaking binary compatibility. I will soon post a patch for the compiler-rt side. Reviewers: rsmith, kcc, vitalybuka, pgousseau, gbedwell Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28242 llvm-svn: 291236
* [CodeCompletion] Block property setters: Use dynamic priority heuristicAlex Lorenz2017-01-061-1/+9
| | | | | | | | | | | | | | Now when completing blocks properties that return void the block call completion result shows up before the setter, otherwise the setter completion shows up before the block call completion. We normally want to use the result of the block call, so one typically wouldn't call a block that returns a non-void type in a standalone statement. rdar://28846153 Differential Revision: https://reviews.llvm.org/D26034 llvm-svn: 291232
* [ObjC] The declarator for a block literal should be a definitionAlex Lorenz2017-01-061-0/+2
| | | | | | | | | | | This change avoids the -Wstrict-prototypes warning for block literals with an empty argument list or without argument lists. rdar://15060615 Differential Revision: https://reviews.llvm.org/D28296 llvm-svn: 291231
* shared_ptrify (from InclusiveRefCntPtr) HeaderSearchOptionsDavid Blaikie2017-01-063-7/+5
| | | | llvm-svn: 291202
* Fix bug where types other than 'cv auto', 'cv auto &', and 'cv auto &&' couldRichard Smith2017-01-051-0/+6
| | | | | | incorrectly be deduced from an initializer list in pathological cases. llvm-svn: 291191
* Add missing "original call argument has same type as deduced parameter type"Richard Smith2017-01-052-27/+98
| | | | | | check for deductions from elements of a braced-init-list. llvm-svn: 291190
* IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and ↵David Blaikie2017-01-058-64/+60
| | | | | | CodeCompleteConsumer llvm-svn: 291184
* Add vec_insert4b and vec_extract4b functions to altivec.hSean Fertile2017-01-052-0/+87
| | | | | | | | | Add builtins for the functions and custom codegen mapping the builtins to their corresponding intrinsics and handling the endian related swapping. https://reviews.llvm.org/D26546 llvm-svn: 291179
* If an explicitly-specified pack might have been extended by template argumentRichard Smith2017-01-051-13/+14
| | | | | | deduction, don't forget to check the argument is valid. llvm-svn: 291170
* Move SerializedDiagnosticPrinter's SharedState to std::shared_ptr rather ↵David Blaikie2017-01-051-4/+4
| | | | | | than IntrusiveRefCntPtr llvm-svn: 291167
* Move Preprocessor over to std::shared_ptr rather than IntrusiveRefCntPtrDavid Blaikie2017-01-054-14/+18
| | | | llvm-svn: 291166
* Move PreprocessorOptions to std::shared_ptr from IntrusiveRefCntPtrDavid Blaikie2017-01-053-9/+10
| | | | llvm-svn: 291160
* Move FailedModulesSet over to shared_ptr from IntrusiveRefCntPtrDavid Blaikie2017-01-051-1/+2
| | | | llvm-svn: 291159
* Move VariantMatcher's Payload to std::shared_ptr rather than IntrusiveRefCntPtrDavid Blaikie2017-01-051-3/+5
| | | | llvm-svn: 291156
* Simplify ASTReader ctor by using in-class initializers for many member variablesDavid Blaikie2017-01-051-19/+1
| | | | llvm-svn: 291155
* Simplify ASTReader ctor by using in-class initializers (NSDMIs to the rest ↵David Blaikie2017-01-051-18/+4
| | | | | | of you) for many member variables llvm-svn: 291154
* Use shared_ptr instead of IntrusiveRefCntPtr for ModuleFileExtensionDavid Blaikie2017-01-057-40/+35
| | | | | | | The intrusiveness wasn't needed here, so this simplifies/clarifies the ownership model. llvm-svn: 291150
* Migrate PathDiagnosticPiece to std::shared_ptrDavid Blaikie2017-01-0517-400/+369
| | | | | | | Simplifies and makes explicit the memory ownership model rather than implicitly passing/acquiring ownership. llvm-svn: 291143
* [CUDA] Rename keywords used in macro so they don't conflict with MSVC.Justin Lebar2017-01-051-21/+21
| | | | | | | | | | | | | | Summary: MSVC seems to use "__in" and "__out" for its own purposes, so we have to pick different names in this macro. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28325 llvm-svn: 291138
* [CUDA] Don't define functions that the CUDA headers themselves define on ↵Justin Lebar2017-01-051-2/+8
| | | | | | | | | | | | Windows. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28324 llvm-svn: 291137
* [CUDA] Let NVPTX inherit the host's calling conventions.Justin Lebar2017-01-051-0/+10
| | | | | | | | | | | | | | | | | | | | Summary: When compiling device code, we may still see host code with explicit calling conventions. NVPTX needs to claim that it supports these CCs, so that (a) we don't raise noisy warnings, and (b) we don't break existing code which relies on the existence of these CCs when specializing templates. (If a CC doesn't exist, clang ignores it, so two template specializations which are different only insofar as one specifies a CC are considered identical and therefore are an error if that CC is not supported.) Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28323 llvm-svn: 291136
* [CUDA] More correctly inherit primitive types from the host during device ↵Justin Lebar2017-01-051-33/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | compilation. Summary: CUDA lets users share structs between the host and device, so for that and other reasons, primitive types such as ptrdiff_t should be the same on both sides of the compilation. Our code to do this wasn't entirely successful. In particular, we did a bunch of work during the NVPTXTargetInfo constructor, only to override it in the NVPTX{32,64}TargetInfo constructors. It worked well enough on Linux and Mac, but Windows is LLP64, which is different enough to break it. This patch removes the NVPTX{32,64}TargetInfo classes entirely and fixes the bug described above. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28322 llvm-svn: 291135
* [ToolChains] Use "static" instead of an anonymous namespace for a function. NFCJustin Lebar2017-01-051-4/+2
| | | | llvm-svn: 291133
* [Driver] Driver changes to support CUDA compilation on Windows.Justin Lebar2017-01-055-15/+77
| | | | | | | | | | | | | | | | | | | | | Summary: For the most part this is straightforward: Just add a CudaInstallation object to the MSVC and MinGW toolchains. CudaToolChain has to override computeMSVCVersion so that Clang::constructJob passes the right version flag to cc1. We have to modify IsWindowsMSVC and friends in Clang::constructJob to be true when compiling CUDA device code on Windows for the same reason. Depends on: D28319 Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28320 llvm-svn: 291131
* [CUDA] Make CUDAInstallationDetector take the host triple in its constructor.Justin Lebar2017-01-052-4/+4
| | | | | | | | | | | | | | | Summary: Previously it was taking the true target triple, which is not really what it needs: The location of the CUDA installation depends on the host OS. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28319 llvm-svn: 291130
* [Windows] Remove functions in intrin.h that are defined in Builtin.def.Justin Lebar2017-01-051-90/+0
| | | | | | | | | | | | | | | | | | | | Summary: These duplicate declarations cause a problem for CUDA compiles on Windows. All implicitly-defined functions are host+device, and this applies to the declarations in Builtin.def. But then when we see the declarations in intrin.h, they have no attributes, so are host-only functions. This is an error. (A better fix might be to make these builtins host-only, but that is a much bigger change.) Reviewers: rnk Subscribers: cfe-commits, echristo Differential Revision: https://reviews.llvm.org/D28317 llvm-svn: 291128
* [OpenMP] Add fields for flags in the offload entry descriptor.Samuel Antao2017-01-054-22/+43
| | | | | | | | | | | | | | | | | Summary: This patch adds two fields to the offload entry descriptor. One field is meant to signal Ctors/Dtors and `link` global variables, and the other is reserved for runtime library use. Currently, these fields are only filled with zeros in the current code generation, but that will change when `declare target` is added. The reason, we are adding these fields now is to make the code generation consistent with the runtime library proposal under review in https://reviews.llvm.org/D14031. Reviewers: ABataev, hfinkel, carlo.bertolli, kkwli0, arpith-jacob, Hahnfeld Subscribers: cfe-commits, caomhin, jholewinski Differential Revision: https://reviews.llvm.org/D28298 llvm-svn: 291124
* CodeGen: plumb header search down to the IASSaleem Abdulrasool2017-01-053-19/+36
| | | | | | | | | | | inline assembly may use the `.include` directive to include other content into the file. Without the integrated assembler, the `-I` group gets passed to the assembler. Emulate this by collecting the header search paths and passing them to the IAS. Resolves PR24811! llvm-svn: 291123
* [OpenMP] Update target codegen for NVPTX device.Arpith Chacko Jacob2017-01-052-162/+153
| | | | | | | | | | | | | | | | | This patch includes updates for codegen of the target region for the NVPTX device. It moves initializers from the compiler to the runtime and updates the worker loop to assume parallel work is retrieved from the runtime. A subsequent patch will update the codegen to retrieve the parallel work using calls to the runtime. It includes the removal of the inline attribute for the worker loop and disabling debug info in it. This allows codegen for a target directive and serial execution on the NVPTX device. Reviewers: ABataev Differential Revision: https://reviews.llvm.org/D28125 llvm-svn: 291121
* [AVR] Revert the functional part of r291083Dylan McKay2017-01-051-2/+1
| | | | | | | As Senthil points out, this is unnecessary as we already have these registers in AddlRegNames. llvm-svn: 291090
* [AVR] Support r26 through r31 in inline assemblyDylan McKay2017-01-051-1/+12
| | | | | | These are synonyms for the X,Y, and Z registers. llvm-svn: 291083
* Add AVR target and toolchain to ClangDylan McKay2017-01-056-0/+144
| | | | | | | | | | | | | | | | | Summary: Authored by Senthil Kumar Selvaraj This patch adds barebones support in Clang for the (experimental) AVR target. It uses the integrated assembler for assembly, and the GNU linker for linking, as lld doesn't know about the target yet. The DataLayout string is the same as the one in AVRTargetMachine.cpp. The alignment specs look wrong to me, as it's an 8 bit target and all types only need 8 bit alignment. Clang failed with a datalayout mismatch error when I tried to change it, so I left it that way for now. Reviewers: rsmith, dylanmckay, cfe-commits, rengolin Subscribers: rengolin, jroelofs, wdng Differential Revision: https://reviews.llvm.org/D27123 llvm-svn: 291082
* Per [temp.deduct.call], do not deduce an array bound of 0 from an empty ↵Richard Smith2017-01-051-1/+3
| | | | | | initializer list. llvm-svn: 291075
* Factor out more common logic in template argument deduction from function ↵Richard Smith2017-01-051-71/+62
| | | | | | | | call arguments. No functionality change intended. llvm-svn: 291074
* Fix assertion failure on deduction failure due to too short template ↵Richard Smith2017-01-051-2/+3
| | | | | | | | | | | | argument list. We were previously incorrectly using TDK_TooFewArguments to report a template argument list that's too short, but it actually means that the number of arguments in a top-level function call was insufficient. When diagnosing the problem, SemaOverload would (rightly) assert that the failure kind didn't make any sense. llvm-svn: 291064
* [MS] Instantiate default args during instantiation of exported default ctorsReid Kleckner2017-01-052-58/+52
| | | | | | | | | | | | | | | | | | | | Summary: Replace some old code that probably pre-dated the change to delay emission of dllexported code until after the closing brace of the outermost record type. Only uninstantiated default argument expressions need to be handled now. It is enough to instantiate default argument expressions when instantiating dllexported default ctors. This also fixes some double-diagnostic issues in this area. Fixes PR31500 Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28274 llvm-svn: 291045
* Correct Vectorcall Register passing and HVA BehaviorErich Keane2017-01-051-26/+180
| | | | | | | | | | | | | Front end component (back end changes are D27392). The vectorcall calling convention was broken subtly in two cases. First, it didn't properly handle homogeneous vector aggregates (HVAs). Second, the vectorcall specification requires that only the first 6 parameters be eligible for register assignment. This patch fixes both issues. Differential Revision: https://reviews.llvm.org/D27529 llvm-svn: 291041
* Only instantiate members of nested classes in local classes once, rather ↵Richard Smith2017-01-041-2/+5
| | | | | | than once per enclosing class. llvm-svn: 291034
* Bail out if we try to build a DeclRefExpr naming an invalid declaration.Richard Smith2017-01-042-0/+5
| | | | | | | | | | | Most code paths would already bail out in this case, but certain paths, particularly overload resolution and typo correction, would not. Carrying on with an invalid declaration could in some cases result in crashes due to downstream code relying on declaration invariants that are not necessarily met for invalid declarations, and in other cases just resulted in undesirable follow-on diagnostics. llvm-svn: 291030
* [Parse] Don't ignore attributes after a late-parsed attr.George Burgess IV2017-01-041-2/+6
| | | | | | | | Without this, we drop everything after the first late-parsed attribute in a single __attribute__. (Where "drop" means "stuff everything into LA->Toks.") llvm-svn: 291020
* Fix for LLVM Bitcode API change (to use std::shared_ptr)David Blaikie2017-01-045-136/+136
| | | | llvm-svn: 291018
* Remove use of intrusive ref count ownership acquisitionDavid Blaikie2017-01-041-1/+1
| | | | | | | | | | | The one use of CheckerManager (AnalysisConsumer, calling createCheckerManager) keeps a strong reference to the AnalysisOptions anyway, so this ownership wasn't necessary. (I'm not even sure AnalysisOptions needs ref counting at all - but that's more involved) llvm-svn: 291017
* Fix failure to treat overloaded function in braced-init-list as a ↵Richard Smith2017-01-042-30/+3
| | | | | | | | | | | | | non-deduced context. Previously, if an overloaded function in a braced-init-list was encountered in template argument deduction, and the overload set couldn't be resolved to a particular function, we'd immediately produce a deduction failure. That's not correct; this situation is supposed to result in that particular P/A pair being treated as a non-deduced context, and deduction can still succeed if the type can be deduced from elsewhere. llvm-svn: 291014
OpenPOWER on IntegriCloud