summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
* [clang-format] Do not merge short case labels if followed by a block.Owen Pan2018-09-211-0/+2
| | | | | | | | | Do not allow short case labels on a single line if the label is followed by a left brace. Fixes PR38926. llvm-svn: 342708
* Fix an assert in -Wquoted-include-in-framework-headerErik Pilkington2018-09-201-1/+1
| | | | | | | | Fixes rdar://43692300 Differential revision: https://reviews.llvm.org/D52253 llvm-svn: 342679
* [Sema] Retain __restrict qualifiers when substituting a reference type.Erik Pilkington2018-09-201-3/+9
| | | | | | | | Fixes rdar://43760099 Differential revision: https://reviews.llvm.org/D52271 llvm-svn: 342672
* r342177 introduced a hint in cases where an #included file is not found. It ↵Eric Christopher2018-09-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | tries to find a suggestion by removing leading or trailing non-alphanumeric characters and checking if a matching file exists, then it reports an error like: include-likely-typo.c:3:10: error: '<empty_file_to_include.h>' file not found, did you mean 'empty_file_to_include.h'? ^~~~~~~~~~~~~~~~~~~~~~~~~~~ "empty_file_to_include.h" 1 error generated. However, if a hint is not found, the error message will show only the trimmed name we use to look for a hint, so: will result in: include-leading-nonalpha-no-suggest.c:3:10: fatal error: 'non_existing_file_to_include.h' file not found ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. where the name reported after "fatal error:" doesn't match what the user wrote. Patch by Jorge Gorbe! Differential Revision: https://reviews.llvm.org/D52280 This change reports the original file name instead of the trimmed one when a suggestion is not found. llvm-svn: 342667
* [OPENMP] Fix spelling of getLoopCounter (NFC)Mike Rice2018-09-203-5/+5
| | | | llvm-svn: 342666
* [OPENMP] Add support for mapping memory pointed by member pointer.Alexey Bataev2018-09-202-11/+279
| | | | | | Added support for map(s, s.ptr[0:1]) kind of mapping. llvm-svn: 342648
* [OpenCL] Diagnose redundant address space conversionSven van Haastregt2018-09-201-0/+7
| | | | | | | | | | | | | | | | Add a warning if a parameter with a named address space is passed to a to_addr builtin. For example: int i; to_private(&i); // generate warning as conversion from private to private is redundant. Patch by Alistair Davies. Differential Revision: https://reviews.llvm.org/D51411 llvm-svn: 342638
* [PowerPC] [Clang] Add vector int128 pack/unpack builtinsQingShan Zhang2018-09-202-0/+34
| | | | | | | | | | | | unsigned long long builtin_unpack_vector_int128 (vector int128_t, int); vector int128_t builtin_pack_vector_int128 (unsigned long long, unsigned long long); Builtins should behave the same way as in GCC. Patch By: wuzish (Zixuan Wu) Differential Revision: https://reviews.llvm.org/D52074 llvm-svn: 342614
* Thread Safety Analysis: warnings for attributes without argumentsAaron Puchert2018-09-201-16/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When thread safety annotations are used without capability arguments, they are assumed to apply to `this` instead. So we warn when either `this` doesn't exist, or the class is not a capability type. This is based on earlier work by Josh Gao that was committed in r310403, but reverted in r310698 because it didn't properly work in template classes. See also D36237. The solution is not to go via the QualType of `this`, which is then a template type, hence the attributes are not known because it could be specialized. Instead we look directly at the class in which we are contained. Additionally I grouped two of the warnings together. There are two issues here: the existence of `this`, which requires us to be a non-static member function, and the appropriate annotation on the class we are contained in. So we don't distinguish between not being in a class and being static, because in both cases we don't have `this`. Fixes PR38399. Reviewers: aaron.ballman, delesley, jmgao, rtrieu Reviewed By: delesley Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51901 llvm-svn: 342605
* Thread safety analysis: Handle ObjCIvarRefExpr in SExprBuilder::translateAaron Puchert2018-09-191-3/+18
| | | | | | | | | | | | | | | | | Summary: This imitates the code for MemberExpr. Fixes PR38896. Reviewers: aaron.ballman, delesley, lukasza, rjmccall Reviewed By: delesley Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52200 llvm-svn: 342600
* Sema: handle `wint_t` more carefully for printf checkingSaleem Abdulrasool2018-09-191-4/+6
| | | | | | | | | In the case that `win_t` is an `unsigned short` (e.g. on Windows), we would previously incorrectly diagnose the conversion because we would immediately promote the argument type from `wint_t` (aka `unsigned short`) to `int` before checking if the type matched. This should repair the Windows hosted bots. llvm-svn: 342565
* [analyzer] Fix nullptr access when processing instantiated function in ↵Shuai Wang2018-09-191-1/+1
| | | | | | ExprMutationAnalyzer. llvm-svn: 342562
* Basic: correct `__WINT_TYPE__` on WindowsSaleem Abdulrasool2018-09-191-0/+1
| | | | | | | | | Windows uses `unsigned short` for `wint_t`. Correct the type definition as vended by the compiler. This type is defined in corecrt.h and is unconditionally typedef'ed. cl does not have an equivalent to `__WINT_TYPE__` which is why this was never detected. llvm-svn: 342557
* [Sema] Do not load macros from preamble when LoadExternal is false.Eric Liu2018-09-191-13/+16
| | | | | | | | | | | | Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52079 llvm-svn: 342528
* Thread safety analysis: Fix crash for function pointersAaron Puchert2018-09-191-9/+11
| | | | | | | | For function pointers, the FunctionDecl of the callee is unknown, so getDirectCallee will return nullptr. We have to catch that case to avoid crashing. We assume there is no attribute then. llvm-svn: 342519
* Add a callback for `__has_include` and use it for dependency scanning.Volodymyr Sapsai2018-09-182-0/+23
| | | | | | | | | | | | | | | | This adds a preprocessor callback for the `__has_include` and `__has_include_next` directives. Successful checking for the presence of a header should add it to the list of header dependencies so this overrides the callback in the dependency scanner. Patch by Pete Cooper with some additions by me. rdar://problem/39545636 Differential Revision: https://reviews.llvm.org/D30882 llvm-svn: 342517
* [MS] Defer dllexport inline friend functions like other inline methodsReid Kleckner2018-09-181-20/+9
| | | | | | | | | | | | | | | This special case was added in r264841, but the code breaks our invariants by calling EmitTopLevelDecl without first creating a HandlingTopLevelDeclRAII scope. This fixes the PCH crash in https://crbug.com/884427. I was never able to make a satisfactory reduction, unfortunately. I'm not very worried about this regressing since this change makes the code simpler while passing the existing test that shows we do emit dllexported friend function definitions. Now we just defer their emission until the tag is fully complete, which is generally good. llvm-svn: 342516
* Driver: extract a local variable for the Toolchain (NFC)Saleem Abdulrasool2018-09-181-53/+47
| | | | | | | Create and store a reference to the current toolchain rather than calling `getToolChain` throughout the function. NFC. llvm-svn: 342515
* Driver: hoist `-mlimit-float-precision` (NFC)Saleem Abdulrasool2018-09-181-5/+5
| | | | | | | | Move the floating point argument handling into the RenderFloatingPointOptions helper. This relocation just puts the floating point related options into a single location. llvm-svn: 342512
* Fix fomit-frame-pointe+pg errorDavid Blaikie2018-09-181-1/+1
| | | | llvm-svn: 342510
* Fix logic around determining use of frame pointer with -pg.Stephen Hines2018-09-181-2/+1
| | | | | | | | | | | | | | | | | | | | Summary: As part of r342165, I rewrote the logic to check whether -fno-omit-frame-pointer was passed after a -fomit-frame-pointer argument. This CL switches that logic to use the consolidated shouldUseFramePointer() function. This fixes a potential issue where -pg gets used with -fomit-frame-pointer on a platform that must always retain frame pointers. Reviewers: dblaikie Reviewed By: dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52191 llvm-svn: 342501
* [Modules] Add platform and environment features to requires clauseBruno Cardoso Lopes2018-09-181-1/+33
| | | | | | | | | | | | | Allows module map writers to add build requirements based on platform/os. This helps when target features and language dialects aren't enough to conditionalize building a module, among other things, it allow module maps for different platforms to live in the same file. rdar://problem/43909745 Differential Revision: https://reviews.llvm.org/D51910 llvm-svn: 342499
* [index] Enhance indexing for module referencesArgyrios Kyrtzidis2018-09-183-2/+51
| | | | | | | * Create a USR for the occurrences of the 'module' symbol kind * Record module references for each identifier in an import declaration llvm-svn: 342484
* [Index] Add an option to collect macros from preprocesor.Eric Liu2018-09-181-1/+22
| | | | | | | | | | | | | | Summary: Also added unit tests for the index library; lit+c-index-test is painful... Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D52098 llvm-svn: 342451
* [CodeComplete] Add completions for filenames in #include directives.Sam McCall2018-09-186-6/+170
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The dir component ("somedir" in #include <somedir/fo...>) is considered fixed. We append "foo" to each directory on the include path, and then list its files. Completions are of the forms: #include <somedir/fo^ foo.h> fox/ The filter is set to the filename part ("fo"), so fuzzy matching can be applied to the filename only. No fancy scoring/priorities are set, and no information is added to CodeCompleteResult to make smart scoring possible. Could be in future. Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52076 llvm-svn: 342449
* [analyzer] ExplodedGraph printing fixesGeorge Karpenkov2018-09-172-44/+24
| | | | | | | | | | | | | Fixes a number of issues: - Global variables are not used for communication - Trait should be defined on a graph, not on a node - Defining the trait on a graph allows us to use a correct allocator, no longer crashing while printing trimmed graphs Differential Revision: https://reviews.llvm.org/D52183 llvm-svn: 342413
* [analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer.Shuai Wang2018-09-171-2/+13
| | | | | | | | | | | | | | | Summary: This is a follow up of D52008 and should make the analyzer being able to handle perfect forwardings in real world cases where forwardings are done through multiple layers of function calls with `std::forward`. Fixes PR38891. Reviewers: lebedev.ri, JonasToth, george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D52120 llvm-svn: 342409
* [ASTImporter] Fix import of VarDecl initGabor Marton2018-09-171-53/+68
| | | | | | | | | | | | | | | | | | Summary: The init expression of a VarDecl is overwritten in the "To" context if we import a VarDecl without an init expression (and with a definition). Please refer to the added tests, especially InitAndDefinitionAreInDifferentTUs. This patch fixes the malfunction by importing the whole Decl chain similarly as we did that in case of FunctionDecls. We handle the init expression similarly to a definition, alas only one init expression will be in the merged ast. Reviewers: a_sidorin, xazax.hun, r.stahl, a.sidorin Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D51597 llvm-svn: 342384
* [OpenCL] Allow blocks to capture arrays in OpenCLAndrew Savonichev2018-09-171-2/+4
| | | | | | | | | | | | | | Summary: Patch by Egor Churaev Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: asavonic, bader, cfe-commits Differential Revision: https://reviews.llvm.org/D51722 llvm-svn: 342370
* Merge two attribute diagnostics into oneAndrew Savonichev2018-09-172-2/+3
| | | | | | | | | | | | | | | | | | Summary: Merged the recently added `err_attribute_argument_negative` diagnostic with existing `err_attribute_requires_positive_integer` diagnostic: the former allows only strictly positive integer, while the latter also allows zero. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51853 llvm-svn: 342367
* [clang-Format] Fix indentation of member call after blockIlya Biryukov2018-09-172-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: before patch: > echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google ``` test() { ([]() -> { int b = 32; return 3; }) .as(); }); ``` after patch: > echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google ``` test() { ([]() -> { int b = 32; return 3; }).as(); }); ``` Patch by Anders Karlsson (ank)! Reviewers: klimek Reviewed By: klimek Subscribers: danilaml, acoomans, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45719 llvm-svn: 342363
* [NFC] Minor refactoring to setup the stage for supporting pointers in ↵Shuai Wang2018-09-161-43/+86
| | | | | | ExprMutationAnalyzer llvm-svn: 342353
* [NFC] cosmetic tweaks to ExprMutationAnalyzer to be more consistentShuai Wang2018-09-151-13/+12
| | | | | | especially considering future changes. llvm-svn: 342340
* [OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC)Kelvin Li2018-09-154-1370/+1336
| | | | | | | | | | | | | | Move declarations for OMPClauseReader, OMPClauseWriter to ASTReader.h and ASTWriter.h and move implementation to ASTReader.cpp and ASTWriter.cpp. This change helps generalize the serialization of OpenMP clauses and will be used in the future implementation of new OpenMP directives (e.g. requires). Patch by Patrick Lyster Differential Revision: https://reviews.llvm.org/D52097 llvm-svn: 342322
* [analyzer] Further printing improvements: use declarations,George Karpenkov2018-09-155-15/+15
| | | | | | | | skip pointers whenever redundant, use unique prefixes. Differential Revision: https://reviews.llvm.org/D52114 llvm-svn: 342316
* Generate unique identifiers for Decl objectsGeorge Karpenkov2018-09-151-0/+7
| | | | | | | | | The generated identifier is stable across multiple runs, and can be a great visualization or debugging aide. Differential Revision: https://reviews.llvm.org/D52113 llvm-svn: 342315
* [analyzer] Generate and use stable identifiers for LocationContextGeorge Karpenkov2018-09-152-5/+5
| | | | | | | | | | Those are not created in the allocator. Since they are created fairly rarely, a counter overhead should not affect the memory consumption. Differential Revision: https://reviews.llvm.org/D51827 llvm-svn: 342314
* [analyzer] Dump reproducible identifiers for statements in exploded graph in ↵George Karpenkov2018-09-153-12/+17
| | | | | | | | store Differential Revision: https://reviews.llvm.org/D51826 llvm-svn: 342313
* [analyzer] Use correct end-of-line character when printing statements for ↵George Karpenkov2018-09-151-4/+7
| | | | | | | | | | exploded graph Prevents bad centering. Differential Revision: https://reviews.llvm.org/D51825 llvm-svn: 342312
* StmtPrinter: allow customizing the end-of-line characterGeorge Karpenkov2018-09-152-54/+57
| | | | | | Differential Revision: https://reviews.llvm.org/D51824 llvm-svn: 342311
* [analyzer] Dump unique identifiers for statements in exploded graphGeorge Karpenkov2018-09-151-18/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D51823 llvm-svn: 342310
* Support generating unique identifiers for Stmt objectsGeorge Karpenkov2018-09-151-0/+8
| | | | | | | | | The generated identifiers are stable across multiple runs, and can be a great debug or visualization aid. Differential Revision: https://reviews.llvm.org/D51822 llvm-svn: 342309
* [analyzer] Skip printing duplicate nodes, even if nodes have multiple ↵George Karpenkov2018-09-151-1/+6
| | | | | | | | | | predecessors/successors Still generate a node, but leave the redundant field empty. Differential Revision: https://reviews.llvm.org/D51821 llvm-svn: 342308
* [modules] Don't bother creating a global module fragment when building aRichard Smith2018-09-151-1/+3
| | | | | | header module. llvm-svn: 342307
* [modules] Support use of -E on modules built from the command line.Richard Smith2018-09-153-10/+9
| | | | llvm-svn: 342306
* [modules] Driver support for precompiling a collection of files as a singleRichard Smith2018-09-155-36/+141
| | | | | | action. llvm-svn: 342305
* [modules] Frontend support for building a header module from a list ofRichard Smith2018-09-158-29/+139
| | | | | | headaer files. llvm-svn: 342304
* [analyzer] Handle forwarding reference better in ExprMutationAnalyzer.Shuai Wang2018-09-141-2/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We used to treat an `Expr` mutated whenever it's passed as non-const reference argument to a function. This results in false positives in cases like this: ``` int x; std::vector<int> v; v.emplace_back(x); // `x` is passed as non-const reference to `emplace_back` ``` In theory the false positives can be suppressed with `v.emplace_back(std::as_const(x))` but that's considered overly verbose, inconsistent with existing code and spammy as diags. This diff handles such cases by following into the function definition and see whether the argument is mutated inside. Reviewers: lebedev.ri, JonasToth, george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits Differential Revision: https://reviews.llvm.org/D52008 llvm-svn: 342271
* Remove PseudoConstantAnalysisShuai Wang2018-09-143-234/+0
| | | | | | | | | | Summary: It's not used anywhere for years. The last usage is removed in https://reviews.llvm.org/rL198476 in 2014. Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D51946 llvm-svn: 342246
* [clang-cl] Fix PR38934: failing to dllexport class template member w/ ↵Hans Wennborg2018-09-141-0/+8
| | | | | | | | | | | | explicit instantiation and PCH The code in ASTContext::DeclMustBeEmitted was supposed to handle this, but didn't take into account that synthesized members such as operator= might not get marked as template specializations, because they're synthesized on the instantiation directly when handling the class-level dllexport attribute. llvm-svn: 342240
OpenPOWER on IntegriCloud