summaryrefslogtreecommitdiffstats
path: root/clang/tools
Commit message (Collapse)AuthorAgeFilesLines
...
* [libclang] Fix the type of 'int (Foo);'Shoaib Meenai2018-05-011-0/+4
| | | | | | | | | | | | | | | | libclang exposes the type of 'int (Foo);' (a global variable of type int called Foo) as CXType_Unexposed. This is because Clang represents Foo's type as ParenType{BuiltinType{Int}}, and libclang does not handle ParenType. Make libclang return CXType_Int as the type of 'int (Foo);' by unwrapping ParenType transparently. Patch by Matt Glazar. Differential Revision: https://reviews.llvm.org/D45713 llvm-svn: 331306
* [MC] Change AsmParser to leverage Assembler during evaluationNirav Dave2018-04-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Teach AsmParser to check with Assembler for when evaluating constant expressions. This improves the handing of preprocessor expressions that must be resolved at parse time. This idiom can be found as assembling-time assertion checks in source-level assemblers. Note that this relies on the MCStreamer to keep sufficient tabs on Section / Fragment information which the MCAsmStreamer does not. As a result the textual output may fail where the equivalent object generation would pass. This can most easily be resolved by folding the MCAsmStreamer and MCObjectStreamer together which is planned for in a separate patch. Currently, this feature is only enabled for assembly input, keeping IR compilation consistent between assembly and object generation. Reviewers: echristo, rnk, probinson, espindola, peter.smith Reviewed By: peter.smith Subscribers: eraman, peter.smith, arichardson, jyknight, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45164 llvm-svn: 331218
* IWYU for llvm-config.h in clang. See r331124 for details.Nico Weber2018-04-303-2/+1
| | | | llvm-svn: 331177
* PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith2018-04-301-3/+7
| | | | | | | | | | | | | | | | | | When a '>>' token is split into two '>' tokens (in C++11 onwards), or (as an extension) when we do the same for other tokens starting with a '>', we can't just use a location pointing to the first '>' as the location of the split token, because that would result in our miscomputing the length and spelling for the token. As a consequence, for example, a refactoring replacing 'A<X>' with something else would sometimes replace one character too many, and similarly diagnostics highlighting a template-id source range would highlight one character too many. Fix this by creating an expansion range covering the first character of the '>>' token, whose spelling is '>'. For this to work, we generalize the expansion range of a macro FileID to be either a token range (the common case) or a character range (used in this new case). llvm-svn: 331155
* s/LLVM_ON_WIN32/_WIN32/, clangNico Weber2018-04-273-6/+6
| | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. llvm-svn: 331069
* [MC] Undo spurious commit added into r331052.Nirav Dave2018-04-271-3/+0
| | | | llvm-svn: 331055
* [MC] Provide default value for IsResolved.Nirav Dave2018-04-271-0/+3
| | | | llvm-svn: 331052
* [MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.Nirav Dave2018-04-271-13/+18
| | | | llvm-svn: 331048
* Revert rC330794 and some dependent tiny bug fixes Faisal Vali2018-04-261-1/+0
| | | | | | | | | | | | | | See Richard's humbling feedback here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html Wish I'd had the patience to solicit the feedback prior to committing :) Sorry for the noise guys. Thank you Richard for being the steward that clang deserves! llvm-svn: 330888
* [c++2a] [concepts] Add rudimentary parsing support for template concept ↵Faisal Vali2018-04-251-0/+1
| | | | | | | | | | | | | | declarations This patch is a tweak of changyu's patch: https://reviews.llvm.org/D40381. It differs in that the recognition of the 'concept' token is moved into the machinery that recognizes declaration-specifiers - this allows us to leverage the attribute handling machinery more seamlessly. See the test file to get a sense of the basic parsing that this patch supports. There is much more work to be done before concepts are usable... Thanks Changyu! llvm-svn: 330794
* Link to AggressiveInstCombine in a few places. Unbreaks build for me.Roman Lebedev2018-04-241-0/+1
| | | | | | | | | | | | /usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass() >>> referenced by cc1_main.cpp >>> tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp) And so on The bot coverage is clearly missing. llvm-svn: 330694
* [libclang] Only mark CXCursors for explicit attributes with a typeErik Verbruggen2018-04-241-1/+1
| | | | | | | | | | | | | | | All attributes have a source range associated with it. However, implicit attributes are added by the compiler, and not added because the user wrote something in the input. So no token type should be set to CXCursor_*Attr. The problem was visible when a class gets marked by e.g. MSInheritanceAttr, which has the full CXXRecordDecl's range as its own range. The effect of marking that range as CXCursor_UnexposedAttr was that all cursors for the record decl, including all child decls, would become CXCursor_UnexposedAttr. llvm-svn: 330692
* Make add_clang_tool() formatting a bit more consistent.Nico Weber2018-04-241-1/+3
| | | | llvm-svn: 330674
* Fix typo in comment.Nico Weber2018-04-231-1/+1
| | | | llvm-svn: 330633
* Fix case of LLVM library names.Nico Weber2018-04-231-3/+3
| | | | llvm-svn: 330604
* Remove unused code (made unused by r161073, and later more so by r248043).Nico Weber2018-04-231-6/+0
| | | | llvm-svn: 330601
* [index] Fix methods that take a shared_ptr to just take a reference.Benjamin Kramer2018-04-232-11/+11
| | | | | | | There is no ownership here, passing a shared_ptr just adds confusion. No functionality change intended. llvm-svn: 330595
* Use InitLLVM in clang as well.Rui Ueyama2018-04-132-26/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D45634 llvm-svn: 330067
* [Index] Return SourceLocation to consumers, not FileID/Offset pair.Sam McCall2018-04-093-19/+17
| | | | | | | | | | | | | | | | | | Summary: The FileID/Offset conversion is lossy. The code takes the fileLoc, which loses e.g. the spelling location in some macro cases. Instead, pass the original SourceLocation which preserves all information, and update consumers to match current behavior. This allows us to fix two bugs in clangd that need the spelling location. Reviewers: akyrtzi, arphaman Subscribers: ilya-biryukov, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D45014 llvm-svn: 329570
* Try to fix libclang reproducer tests after r329465Hans Wennborg2018-04-091-2/+2
| | | | | | | | | | | | | | | | | | | | They were failing on Windows because the output YAML didn't parse: YAML:1:664: error: Unrecognized escape code! {"toolchain":"D:\\buildslave\\clang-x64-ninja-win7\\stage1", "libclang.operation":"complete", "libclang.opts":1, "args":["clang", "-fno-spell-checking", "D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c", "-Xclang", "-detailed-preprocessing-record", "-fallow-editor-placeholders"], "invocation-args":["-code-completion-at=D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c:10:1"], "unsaved_file_hashes":[{"name":"D:\\buildslave\\clang-x64-ninja-win7\\llvm\\tools\\clang\\test\\Index\\create-libclang-completion-reproducer.c", "md5":"aee23773de90e665992b48209351d70e"}]} This adds some more escaping to try to make it work. llvm-svn: 329558
* [libclang] Add clang_File_tryGetRealPathNameFangrui Song2018-04-072-0/+9
| | | | | | | | | | | | | | | | | | | | | Summary: clang_getFileName() may return a path relative to WorkingDir. On Arch Linux, during clang_indexTranslationUnit(), clang_getFileName() on CXIdxIncludedIncludedFileInfo::file may return "/../lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string", for `#include <string>`. I presume WorkingDir is somehow changed to /usr/lib or /usr/include and clang_getFileName() returns a path relative to WorkingDir. clang_File_tryGetRealPathName() returns "/usr/include/c++/7.3.0/string" which is more useful for the indexer in this case. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42893 llvm-svn: 329515
* Recommit r329442: Generate Libclang invocation reproducers using a newAlex Lorenz2018-04-074-1/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | -cc1gen-reproducer driver option The recommit fixes: - An MSAN failure (CCPrintOptions wasn't initialized in the Driver) - Ensures that the strings in the libclang invocation files are escaped Original message: This commit is a follow up to the previous work that recorded Libclang invocations into temporary files: r319702. It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate Clang reproducer files for Libclang tool invocation. The JSON format in the invocation files is not really intended to be stable, so Libclang and Clang should be of the same version when generating reproducers. The new mode emits the information about the temporary files and Libclang-specific information to stdout using JSON. rdar://35322614 Differential Revision: https://reviews.llvm.org/D40983 llvm-svn: 329465
* Revert r329442 "Generate Libclang invocation reproducers using a newAlex Lorenz2018-04-063-201/+0
| | | | | | | | -cc1gen-reproducer driver option" The tests are failing on some bots llvm-svn: 329447
* Generate Libclang invocation reproducers using a new -cc1gen-reproducerAlex Lorenz2018-04-063-0/+201
| | | | | | | | | | | | | | | | | | | | driver option This commit is a follow up to the previous work that recorded Libclang invocations into temporary files: r319702. It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate Clang reproducer files for Libclang tool invocation. The JSON format in the invocation files is not really intended to be stable, so Libclang and Clang should be of the same version when generating reproducers. The new mode emits the information about the temporary files and Libclang-specific information to stdout using JSON. rdar://35322614 Differential Revision: https://reviews.llvm.org/D40983 llvm-svn: 329442
* Fix typos in clangAlexander Kornienko2018-04-0611-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* Allow the creation of human-friendly ASTDumper to arbitrary output streamAlexander Kornienko2018-04-062-2/+5
| | | | | | | | | | | | | | | | | | | | | Summary: `ASTPrinter` allows setting the ouput to any O-Stream, but that printer creates source-code-like syntax (and is also marked with a `FIXME`). The nice, colourful, mostly human-readable `ASTDumper` only works on the standard output, which is not feasible in case a user wants to see the AST of a file through a code navigation/comprehension tool. This small addition of an overload solves generating a nice colourful AST block for the users of a tool I'm working on, [[ http://github.com/Ericsson/CodeCompass | CodeCompass ]], as opposed to having to duplicate the behaviour of definitions that only exist in the anonymous namespace of implementation TUs related to this module. Reviewers: alexfh, klimek, rsmith Reviewed By: alexfh Subscribers: rnkovacs, dkrupp, gsd, xazax.hun, cfe-commits, #clang Tags: #clang Patch by Whisperity! Differential Revision: https://reviews.llvm.org/D45096 llvm-svn: 329391
* Revert "Set calling convention for CUDA kernel"Artem Belevich2018-04-031-1/+0
| | | | | | | This reverts r328795 which introduced an issue with referencing __global__ function templates. More details in the original review D44747. llvm-svn: 329099
* Set calling convention for CUDA kernelYaxun Liu2018-03-291-0/+1
| | | | | | | | | | | This patch sets target specific calling convention for CUDA kernels in IR. Patch by Greg Rodgers. Revised and lit test added by Yaxun Liu. Differential Revision: https://reviews.llvm.org/D44747 llvm-svn: 328795
* [clang] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-03-272-7/+7
| | | | | | | | | | | r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. llvm-svn: 328636
* [clang-format] Wildcard expansion on Windows.Alexander Kornienko2018-03-261-1/+10
| | | | | | | | | | | | | | | | | | Summary: Add support for wildcard expansion in command line arguments on Windows. See https://docs.microsoft.com/en-us/cpp/c-language/expanding-wildcard-arguments Fixes https://bugs.llvm.org/show_bug.cgi?id=17217 Reviewers: klimek, djasper, rnk Reviewed By: rnk Subscribers: rnk, smeenai, zturner, alexfh, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D44778 llvm-svn: 328495
* [Driver] Avoid invalidated iterator in insertTargetAndModeArgsSerge Pavlov2018-03-191-4/+5
| | | | | | | | | | | | | | Doing an .insert() can potentially invalidate iterators by reallocating the vector's storage. When all the stars align just right, this causes segfaults or glibc aborts. Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082. Patch by Hector Martin! Differential Revision: https://reviews.llvm.org/D44607 llvm-svn: 327863
* clang-import-test: fix build with clang-3.8Pavel Labath2018-03-131-1/+1
| | | | | | | | clang-3.8 complains that constructor for '...' must explicitly initialize the const object. Newer clangs and gcc seem to be fine with this, but explicitly initializing the variable does not hurt. llvm-svn: 327383
* Resubmit [analyzer] Support for naive cross translation unit analysisIlya Biryukov2018-03-018-34/+495
| | | | | | | | | | | Originally submitted as r326323 and r326324. Reverted in r326432. Reverting the commit was a mistake. The breakage was due to invalid build files in our internal buildsystem, CMakeLists did not have any cyclic dependencies. llvm-svn: 326439
* Revert "[analyzer] Support for naive cross translation unit analysis"Ilya Biryukov2018-03-018-495/+34
| | | | | | | | | | Also revert "[analyzer] Fix a compiler warning" This reverts commits r326323 and r326324. Reason: the commits introduced a cyclic dependency in the build graph. This happens to work with cmake, but breaks out internal integrate. llvm-svn: 326432
* [analyzer] Support for naive cross translation unit analysisGabor Horvath2018-02-288-34/+495
| | | | | | | | | | | | | | | | | | The aim of this patch is to be minimal to enable incremental development of the feature on the top of the tree. This patch should be an NFC when the feature is turned off. It is turned off by default and still considered as experimental. Technical details are available in the EuroLLVM Talk: http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#7 Note that the initial prototype was done by A. Sidorin et al.: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045730.html Contributions to the measurements and the new version of the code: Peter Szecsi, Zoltan Gera, Daniel Krupp, Kareem Khazem. Differential Revision: https://reviews.llvm.org/D30691 llvm-svn: 326323
* Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-3/+1
| | | | | | | | | | | | std::unique_ptr<>" This reverts commit rL326201 This broke gcc4.8 builds, compiler just segfaults:¬ http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909¬ http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673¬ llvm-svn: 326204
* [Tooling] [0/1] Refactor FrontendActionFactory::create() to return ↵Roman Lebedev2018-02-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | std::unique_ptr<> Summary: Noticed during review of D41102. I'm not sure whether there are any principal reasons why it returns raw owning pointer, or it is just a old code that was not updated post-C++11. I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason, but it does not //appear// asif those failures are related to these changes. This is clang part. Clang-tools-extra part is D43780. Reviewers: klimek, bkramer, alexfh, pcc Reviewed By: alexfh Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D43779 llvm-svn: 326201
* Clean up use of C allocation functionsSerge Pavlov2018-02-214-4/+20
| | | | | | | | | | | | | | | | If the value returned by `malloc`, `calloc` or `realloc` is not checked for null pointer, this change replaces them for `safe_malloc`, `safe_calloc` or `safe_realloc`, which are defined in the namespace `llvm`. These function report fatal error on out of memory. In the plain C files, assertion statements are added to ensure that memory is successfully allocated. The aim of this change is to get better diagnostics of OOM on Windows. Differential Revision: https://reviews.llvm.org/D43017 llvm-svn: 325661
* clang-format plugin: Add missing semicolon in list of file extensions (PR36383)Hans Wennborg2018-02-201-1/+1
| | | | llvm-svn: 325566
* Update for llvm change. NFC.Rafael Espindola2018-02-141-1/+1
| | | | llvm-svn: 325156
* [libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfoFangrui Song2018-02-123-9/+43
| | | | | | | | | | | | | | | | | | Summary: CXIdxEntityRefInfo contains the member `CXIdxEntityRefKind kind;` to differentiate implicit and direct calls. However, there are more roles defined in SymbolRole. Among them, `Read/Write` are probably the most useful ones as they can be used to differentiate Read/Write occurrences of a symbol for document highlight in a text document. See `export namespace DocumentHighlightKind` on https://microsoft.github.io/language-server-protocol/specification Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42895 llvm-svn: 324914
* [clang-import-test] Run clang-format, NFCVedant Kumar2018-02-071-8/+9
| | | | | | | I ran across clang-import-test while looking into testing for lldb. There shouldn't be any harm in running clang-format over it. llvm-svn: 324527
* [clang-proto-to-cxx] Accept protobufs with missing fields.Matt Morehouse2018-02-021-1/+1
| | | | | | | | libprotobuf-mutator accepts protobufs with missing fields, which means clang-proto-fuzzer does as well. clang-proto-to-cxx should match this behavior. llvm-svn: 324132
* [clang-format] Fix bug where -dump-config failed on ObjC headerBen Hamilton2018-01-291-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: `clang-format -dump-config path/to/file.h` never passed anything for the Code parameter to clang::format::getStyle(). This meant the logic to guess Objective-C from the contents of a .h file never worked, because LibFormat didn't have the code to work with. With this fix, we now correctly read in the contents of the file if possible with -dump-config. I had to update the lit config for test/Format/ because the default config ignores .h files. Test Plan: make -j12 check-clang Reviewers: jolesiak, krasimir Reviewed By: jolesiak, krasimir Subscribers: Wizard, klimek, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D42395 llvm-svn: 323668
* [scan-build] Add an option to skip overriding CC and CXX make varsJonathan Roelofs2018-01-291-4/+20
| | | | | | | | | | | | | | Autoconf and some other systems tend to add essential compilation options to CC (e.g. -std=gnu99). When running such an auto-generated makefile, scan-build does not need to change CC and CXX as they are already set to use ccc-analyzer by a configure script. Implement a new option --keep-cc as was proposed in this discussion: http://lists.llvm.org/pipermail/cfe-dev/2013-September/031832.html Patch by Paul Fertser! llvm-svn: 323665
* [analyzer] Fix -x language argument for C preprocessed sourcesJonathan Roelofs2018-01-291-2/+2
| | | | | | | | | | | | | clang's -x option doesn't accept c-cpp-output as a language (even though 463eb6ab was merged, the driver still doesn't handle that). This bug prevents testing C language projects when ccache is used. Fixes #25851. Investigation and patch by Dave Rigby. llvm-svn: 323664
* [NFC] fix trivial typos in commentsHiroshi Inoue2018-01-291-1/+1
| | | | | | "to to" -> "to" llvm-svn: 323627
* [git-clang-format] Process CUDA filesJonas Hahnfeld2018-01-281-0/+1
| | | | | | | | | Clang supports compiling CUDA source files for some time, format them by default as well. Differential Revision: https://reviews.llvm.org/D42589 llvm-svn: 323615
* Fix typos of occurred and occurrenceMalcolm Parsons2018-01-242-2/+2
| | | | llvm-svn: 323316
* c-index-test: small fix to CXString handling and disposalSteve O'Brien2018-01-181-17/+19
| | | | | | | | | | | | Summary: (Separating some unrelated changes out of D42043) Reviewers: vsk, benlangmuir, akyrtzi Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42259 llvm-svn: 322883
OpenPOWER on IntegriCloud