summaryrefslogtreecommitdiffstats
path: root/lib/Lex
Commit message (Collapse)AuthorAgeFilesLines
* [backported/clang-9][Preamble] Stop circular inclusion of main file when ↵release_80-basedNikolai Kosjar2019-05-211-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | building preamble -------------------------------------------------------------------------- https://reviews.llvm.org/D53866 -------------------------------------------------------------------------- If a header file was processed for the second time, we could end up with a wrong conditional stack and skipped ranges: In the particular example, if the header guard is evaluated the second time and it is decided to skip the conditional block, the corresponding "#endif" is never seen since the preamble does not include it and we end up in the Tok.is(tok::eof) case with a wrong conditional stack. Detect the circular inclusion, emit a diagnostic and stop processing the inclusion. Fixes: QTCREATORBUG-20883 Change-Id: I02644ddb507db4033dd5c69920c8e10500f0121c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Merging r352229:Hans Wennborg2019-01-281-4/+5
| | | | | | | | | | | | | | | | | | Redirecting to URL 'https://llvm.org/svn/llvm-project/cfe/trunk': ------------------------------------------------------------------------ r352229 | erichkeane | 2019-01-25 19:36:20 +0100 (Fri, 25 Jan 2019) | 7 lines Remove F16 literal support based on Float16 support. Float16 support was disabled recently on many platforms, however that commit still allowed literals of Float16 type to work. This commit removes those based on the same logic as Float16 disable. Change-Id: I72243048ae2db3dc47bd3d699843e3edf9c395ea ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_80@352365 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Remove error return value from one overload of fs::make_absolutePavel Labath2019-01-161-3/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: The version of make_absolute which accepted a specific directory to use as the "base" for the computation could never fail, even though it returned a std::error_code. The reason for that seems to be historical -- the CWD flavour (which can fail due to failure to retrieve CWD) was there first, and the new version was implemented by extending that. This removes the error return value from the non-CWD overload and reimplements the CWD version on top of that. This enables us to remove some dead code where people were pessimistically trying to handle the errors returned from this function. Reviewers: zturner, sammccall Subscribers: hiraditya, kristina, llvm-commits Differential Revision: https://reviews.llvm.org/D56599 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351317 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSVC Compat] Fix typo correction for inclusion directives.Volodymyr Sapsai2019-01-151-1/+9
| | | | | | | | | | | | | | | | In MSVC compatibility mode we were checking not the typo corrected filename but the original filename. Reviewers: christylee, compnerd Reviewed By: christylee Subscribers: jkorous, dexonsmith, sammccall, hokein, cfe-commits Differential Revision: https://reviews.llvm.org/D56631 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351232 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Correct the source range returned from preprocessor callbacks."Benjamin Kramer2019-01-152-48/+36
| | | | | | | This reverts commit r350891. Also add a test case that would return an empty string with r350891. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351209 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an explicit initializer to silence a -Wmissing-field-initializers ↵Aaron Ballman2019-01-111-1/+1
| | | | | | diagnostic; NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350912 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct the source range returned from preprocessor callbacks.Aaron Ballman2019-01-102-35/+47
| | | | | | This adjusts the source range passed in to the preprocessor callbacks to only include the condition range itself, rather than all of the conditionally skipped tokens. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350891 91177308-0d34-0410-b5e6-96231b3b80d8
* Add vtable anchor to classes.Richard Trieu2018-12-291-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350143 91177308-0d34-0410-b5e6-96231b3b80d8
* Misc typos fixes in ./lib folderRaphael Isemann2018-12-103-4/+4
| | | | | | | | | | | | | | Summary: Found via `codespell -q 3 -I ../clang-whitelist.txt -L uint,importd,crasher,gonna,cant,ue,ons,orign,ned` Reviewers: teemperor Reviewed By: teemperor Subscribers: teemperor, jholewinski, jvesely, nhaehnle, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D55475 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348755 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocessor] Don't avoid entering included files after hitting a fatal error.Volodymyr Sapsai2018-12-071-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Change in r337953 violated the contract for `CXTranslationUnit_KeepGoing`: > Do not stop processing when fatal errors are encountered. Use different approach to fix long processing times with multiple inclusion cycles. Instead of stopping preprocessing for fatal errors, do this after reaching the max allowed include depth and only for the files that were processed already. It is likely but not guaranteed those files cause a cycle. rdar://problem/46108547 Reviewers: erik.pilkington, arphaman Reviewed By: erik.pilkington Subscribers: jkorous, dexonsmith, ilya-biryukov, Dmitry.Kozhevnikov Differential Revision: https://reviews.llvm.org/D55095 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348641 91177308-0d34-0410-b5e6-96231b3b80d8
* PTH-- Remove feature entirely-Erich Keane2018-12-047-944/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging a boost build with a modified version of Clang, I discovered that the PTH implementation stores TokenKind in 8 bits. However, we currently have 368 TokenKinds. The result is that the value gets truncated and the wrong token gets picked up when including PTH files. It seems that this will go wrong every time someone uses a token that uses the 9th bit. Upon asking on IRC, it was brought up that this was a highly experimental features that was considered a failure. I discovered via googling that BoostBuild (mostly Boost.Math) is the only user of this feature, using the CC1 flag directly. I believe that this can be transferred over to normal PCH with minimal effort: https://github.com/boostorg/build/issues/367 Based on advice on IRC and research showing that this is a nearly completely unused feature, this patch removes it entirely. Note: I considered leaving the build-flags in place and making them emit an error/warning, however since I've basically identified and warned the only user, it seemed better to just remove them. Differential Revision: https://reviews.llvm.org/D54547 Change-Id: If32744275ef1f585357bd6c1c813d96973c4d8d9 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348266 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix combining pragma __debug dump & parser_crash with -EDavid Blaikie2018-11-151-4/+0
| | | | | | | | | | | | | | | | | | | | | | | Previously these would be transformed into annotation tokens and the preprocessor would then assume they were real tokens with source locations and assert/UB. Other pragmas that produce annotation tokens aren't a problem because they aren't handled if the parser isn't hooked up - ParsePragma.cpp registers those handlers & isn't run for pure preprocessing. So they're treated as unknown pragmas & printed verbatim by the preprocessor. Perhaps these pragmas should be treated the same way? But they got mixed in with other __debug pragmas that do need to be handled during preprocessing. The third __debug pragma that produces an annotation token is 'captured' - which had its own fix for this issue - by not inserting the annotation token in the first place if it detected that it was in preprocessing mode. I've removed that fix (from Lex/Pragma.cpp) in favor of the more general one in Frontend/PrintPreprocessedOutput.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346928 91177308-0d34-0410-b5e6-96231b3b80d8
* [HeaderSearch] loadSubdirectoryModuleMaps should respect -working-directoryAlex Lorenz2018-11-141-1/+3
| | | | | | | | | | | | Include search paths can be relative paths. The loadSubdirectoryModuleMaps function should account for that and respect the -working-directory parameter given to Clang. rdar://46045849 Differential Revision: https://reviews.llvm.org/D54503 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346822 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"Benjamin Kramer2018-11-051-1/+1
| | | | | | | | | | | | | This reverts commit r345963. We have a path forward now. Original commit message: The driver accidentally stopped passing the input filenames on to -cc1 in this mode due to confusion over what action was being requested. This change also fixes a couple of crashes I encountered when passing multiple files to such a -cc1 invocation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346130 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"Ilya Biryukov2018-11-021-1/+1
| | | | | | | | | | This reverts commit r345803 and r345915 (a follow-up fix to r345803). Reason: r345803 blocks our internal integrate because of the new warnings showing up in too many places. The fix is actually correct, we will reland it after figuring out how to integrate properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345963 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix clang -Wimplicit-fallthrough warnings across llvm, NFCReid Kleckner2018-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch should not introduce any behavior changes. It consists of mostly one of two changes: 1. Replacing fall through comments with the LLVM_FALLTHROUGH macro 2. Inserting 'break' before falling through into a case block consisting of only 'break'. We were already using this warning with GCC, but its warning behaves slightly differently. In this patch, the following differences are relevant: 1. GCC recognizes comments that say "fall through" as annotations, clang doesn't 2. GCC doesn't warn on "case N: foo(); default: break;", clang does 3. GCC doesn't warn when the case contains a switch, but falls through the outer case. I will enable the warning separately in a follow-up patch so that it can be cleanly reverted if necessary. Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu Differential Revision: https://reviews.llvm.org/D53950 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345882 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix regression in behavior of clang -x c++-header -fmodule-name=XXXRichard Smith2018-11-011-1/+1
| | | | | | | | | | | | -fsyntax-only. The driver accidentally stopped passing the input filenames on to -cc1 in this mode due to confusion over what action was being requested. This change also fixes a couple of crashes I encountered when passing multiple files to such a -cc1 invocation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345803 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lex] Make MacroDirective::findDirectiveAtLoc take const SourceManagerKristof Umann2018-10-311-1/+2
| | | | | | | | | | I'm currently working on including macro expansions in the Static Analyzer's plist output, where I can only access a const SourceManager. Differential Revision: https://reviews.llvm.org/D53940 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345741 91177308-0d34-0410-b5e6-96231b3b80d8
* NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)Erik Pilkington2018-10-302-6/+6
| | | | | | | | | | We haven't supported compiling ObjC1 for a long time (and never will again), so there isn't any reason to keep these separate. This patch replaces LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC. Differential revision: https://reviews.llvm.org/D53547 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345637 91177308-0d34-0410-b5e6-96231b3b80d8
* Lift VFS from clang to llvm (NFC)Jonas Devlieghere2018-10-104-15/+19
| | | | | | | | | | | | | | | | | | | This patch moves the virtual file system form clang to llvm so it can be used by more projects. Concretely the patch: - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support. - Moves the corresponding unit test from clang to llvm. - Moves the vfs namespace from clang::vfs to llvm::vfs. - Formats the lines affected by this change, mostly this is the result of the added llvm namespace. RFC on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html Differential revision: https://reviews.llvm.org/D52783 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344140 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocesssor] Filename should fall back to the written name when typo ↵Haojian Wu2018-10-021-8/+12
| | | | | | | | | | | | | | | | | | correction fails. Summary: The test is added in Testcase is at https://reviews.llvm.org/D52775. I tried to add the test to clang's code completion test, it doesn't reproduce the crash. Reviewers: sammccall, kristina Reviewed By: sammccall Subscribers: kristina, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52774 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343592 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocessor] Hide include typo correction behind SpellChecking.Haojian Wu2018-10-021-1/+1
| | | | | | | | | | | | | | Summary: Similar to Sema typo correction, the Preprocessor typo correction should also be hidden behind the SpellChecking flag. Reviewers: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52778 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343591 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocessor] Fix a crash when handling non-alpha include header.Haojian Wu2018-10-011-7/+10
| | | | | | | | | | | | | Summary: the crash is casued by an assertion in StringRef. (llvm::StringRef::front() const: Assertion `!empty()' failed.) Reviewers: sammccall Subscribers: jsji, cfe-commits Differential Revision: https://reviews.llvm.org/D52721 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343481 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lex] TokenConcatenation now takes const PreprocessorKristof Umann2018-09-271-2/+2
| | | | | | | Differential Revision: https://reviews.llvm.org/D52502 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343204 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't emit "will be treated as an identifier character" warning forRichard Smith2018-09-251-4/+2
| | | | | | | UTF-8 characters that aren't identifier characters in the current language mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343040 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an assert in -Wquoted-include-in-framework-headerErik Pilkington2018-09-201-1/+1
| | | | | | | | Fixes rdar://43692300 Differential revision: https://reviews.llvm.org/D52253 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342679 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342667 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a callback for `__has_include` and use it for dependency scanning.Volodymyr Sapsai2018-09-181-0/+8
| | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342517 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeComplete] Add completions for filenames in #include directives.Sam McCall2018-09-182-5/+49
| | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342449 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Frontend support for building a header module from a list ofRichard Smith2018-09-151-8/+31
| | | | | | headaer files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342304 91177308-0d34-0410-b5e6-96231b3b80d8
* [VFS] vfs::directory_iterator yields path and file type instead of full StatusSam McCall2018-09-143-14/+12
| | | | | | | | | | | | | | | | | | | | | | | Summary: Most callers I can find are using only `getName()`. Type is used by the recursive iterator. Now we don't have to call stat() on every listed file (on most platforms). Exceptions are e.g. Solaris where readdir() doesn't include type information. On those platforms we'll still stat() - see D51918. The result is significantly faster (stat() can be slow). My motivation: this may allow us to improve clang IO on large TUs with long include search paths. Caching readdir() results may allow us to skip many stat() and open() operations on nonexistent files. Reviewers: bkramer Subscribers: fedor.sergeev, cfe-commits Differential Revision: https://reviews.llvm.org/D51921 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342232 91177308-0d34-0410-b5e6-96231b3b80d8
* Diagnose likely typos in #include directives.Richard Smith2018-09-131-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When someone writes #include "<some_file>" or #include " some_file " the compiler returns "file not fuond..." with fonts and quotes that may make it hard to see there are excess quotes or surprising bytes in the filename. Assuming that files are usually logically named and start and end with an alphanumeric character, we can check for the file's existence by stripping the non-alphanumeric leading or trailing characters. If the file is found, emit a non-fatal error with a FixItHint. Patch by Christy Lee! Reviewers: aaron.ballman, erikjv, rsmith Reviewed By: rsmith Subscribers: lebedev.ri, xbolva00, sammccall, modocache, erikjv, aaron.ballman, cfe-commits Differential Revision: https://reviews.llvm.org/D51333 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342177 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstopMike Rice2018-09-113-21/+95
| | | | | | | | | | | | | | | With clang-cl, when the user specifies /Yc or /Yu without a filename the compiler uses a #pragma hdrstop in the main source file to determine the end of the PCH. If a header is specified with /Yc or /Yu #pragma hdrstop has no effect. The optional #pragma hdrstop filename argument is not yet supported. Differential Revision: https://reviews.llvm.org/D51391 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341963 91177308-0d34-0410-b5e6-96231b3b80d8
* PR38870: Add warning for zero-width unicode characters appearing inRichard Smith2018-09-071-3/+18
| | | | | | identifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341700 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lex] Make HeaderMaps a unique_ptr vectorFangrui Song2018-08-202-12/+7
| | | | | | | | | | | | Summary: unique_ptr makes the ownership clearer than a raw pointer container. Reviewers: Eugene.Zelenko, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50945 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340198 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a newline to SourceLocation dump outputStephen Kelly2018-08-151-1/+1
| | | | | | | | | | | | | | Summary: Migrate callers to print(). dump() should be useful to downstreams and third parties as a debugging aid. Everyone trips up on this and creates confusing output. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50661 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339810 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Store code completion token range in preprocessor.Kadir Cetinkaya2018-08-131-0/+1
| | | | | | | | | | | | | | | | | Summary: This change is to support a new fature in clangd, tests will be send toclang-tools-extra with that change. Unittests are included in: https://reviews.llvm.org/D50449 Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D50443 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339540 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing spaceFangrui Song2018-07-3012-191/+191
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338291 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocessor] Stop entering included files after hitting a fatal error.Volodymyr Sapsai2018-07-251-0/+6
| | | | | | | | | | | | | | | | | | | Fixes a problem when we have multiple inclusion cycles and try to enumerate all possible ways to reach the max inclusion depth. rdar://problem/38871876 Reviewers: bruno, rsmith, jkorous, aaron.ballman Reviewed By: bruno, jkorous, aaron.ballman Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D48786 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337953 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable C++2a Chrono LiteralsErich Keane2018-07-191-3/+8
| | | | | | | | | | | | | | | | | | | | C++2a via http://wg21.link/p0355 permits the library literals of 'd' and 'y'. This patch enables them in the Lexer so that they can be properly parsed. Note that 'd' gets confused with the hex character, so modifications to how octal, binary, and decimal numbers are parsed were required. Since this is simply making previously invalid code legal, this should be fine. Hex still greedily parses the 'd' as a hexit, since it would a: violate [lex.ext]p1 b: break existing code. Differential Revision: https://reviews.llvm.org/D49504 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337454 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r336660: [Modules] Autoload subdirectory modulemaps with specific ↵Bruno Cardoso Lopes2018-07-181-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | LangOpts Summary: Reproducer and errors: https://bugs.llvm.org/show_bug.cgi?id=37878 lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't find ModuleName in (proper) search paths. This was causing iteration over all files in the search path subdirectories for example "/usr/include/foobar" in bugzilla case. Users don't expect Clang to load modulemaps in subdirectories implicitly, and also the disk access is not cheap. if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName. Reviewers: rsmith, aprantl, bruno Subscribers: cfe-commits, teemperor, v.g.vassilev Differential Revision: https://reviews.llvm.org/D48367 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337430 91177308-0d34-0410-b5e6-96231b3b80d8
* [Fixed Point Arithmetic] Fix for bug where integer literals could be treated ↵Leonard Chan2018-07-171-5/+10
| | | | | | | | | | | | | | | | as fixed point literals This addresses a bug brought up in https://bugs.llvm.org/show_bug.cgi?id=38161 where integer literals could be treated as fixed point types and throw errors related to fixed point types when the 'k' or 'r' suffix used. The fix also addresses the second issue brought up with the assertion by not treating integers as fixed point types in the first place. Integers that have suffixes 'k' and 'r' now throw the error `invalid suffix 'k/r' on integer constant`. A few more tests were also added to ensure that fixed point types, and any errors/warnings related to them, are limited to C for now. Prior discussion also at https://reviews.llvm.org/D46915. Differential Revision: https://reviews.llvm.org/D49327 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337289 91177308-0d34-0410-b5e6-96231b3b80d8
* PR15730/PR16986 Allow dependently typed vector_size types.Erich Keane2018-07-131-1/+1
| | | | | | | | | | | | | | | | | | As listed in the above PRs, vector_size doesn't allow dependent types/values. This patch introduces a new DependentVectorType to handle a VectorType that has a dependent size or type. In the future, ALL the vector-types should be able to create one of these to handle dependent types/sizes as well. For example, DependentSizedExtVectorType could likely be switched to just use this instead, though that is left as an exercise for the future. Differential Revision: https://reviews.llvm.org/D49045 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337036 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[modules] Fix 37878; Autoload subdirectory modulemaps with specific ↵Bruno Cardoso Lopes2018-07-121-10/+7
| | | | | | | | | | | | | | | LangOpts" This reverts commit f40124d4f05ecf4f880cf4e8f26922d861f705f3 / r336660. This change shouldn't be affecting `@import` behavior, but turns out it is: https://ci.swift.org/view/swift-master-next/job/oss-swift-incremental-RA-osx-master-next/2800/consoleFull#-12570166563122a513-f36a-4c87-8ed7-cbc36a1ec144 Working on a reduced testcase for this, reverting in the meantime. rdar://problem/42102222 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336920 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOptsYuka Takahashi2018-07-101-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Reproducer and errors: https://bugs.llvm.org/show_bug.cgi?id=37878 lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't find ModuleName in (proper) search paths. This was causing iteration over all files in the search path subdirectories for example "/usr/include/foobar" in bugzilla case. Users don't expect Clang to load modulemaps in subdirectories implicitly, and also the disk access is not cheap. if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName. Reviewers: rsmith, aprantl, bruno Subscribers: cfe-commits, teemperor, v.g.vassilev Differential Revision: https://reviews.llvm.org/D48367 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336660 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-cl, PCH] Implement support for MS-style PCH through headersErich Keane2018-07-053-3/+130
| | | | | | | | | | | | | | | | | | | | | | Implement support for MS-style PCH through headers. This enables support for /Yc and /Yu where the through header is either on the command line or included in the source. It replaces the current support the requires the header also be specified with /FI. This change adds a -cc1 option -pch-through-header that is used to either start or stop compilation during PCH create or use. When creating a PCH, the compilation ends after compilation of the through header. When using a PCH, tokens are skipped until after the through header is seen. Patch By: mikerice Differential Revision: https://reviews.llvm.org/D46652 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336379 91177308-0d34-0410-b5e6-96231b3b80d8
* Warning for framework include violation from Headers to PrivateHeadersBruno Cardoso Lopes2018-06-251-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Framework vendors usually layout their framework headers in the following way: Foo.framework/Headers -> "public" headers Foo.framework/PrivateHeader -> "private" headers Since both headers in both directories can be found with #import <Foo/some-header.h>, it's easy to make mistakes and include headers in Foo.framework/PrivateHeader from headers in Foo.framework/Headers, which usually configures a layering violation on Darwin ecosystems. One of the problem this causes is dep cycles when modules are used, since it's very common for "private" modules to include from the "public" ones; adding an edge the other way around will trigger cycles. Add a warning to catch those cases such that: ./A.framework/Headers/A.h:1:10: warning: public framework header includes private framework header 'A/APriv.h' #include <A/APriv.h> ^ rdar://problem/38712182 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335542 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply: Warning for framework headers using double quote includesBruno Cardoso Lopes2018-06-221-1/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce -Wquoted-include-in-framework-header, which should fire a warning whenever a quote include appears in a framework header and suggest a fix-it. For instance, for header A.h added in the tests, this is how the warning looks like: ./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header] #include "A0.h" ^~~~~~ <A/A0.h> ./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header] #include "B.h" ^~~~~ <B.h> This helps users to prevent frameworks from using local headers when in fact they should be targetting system level ones. The warning is off by default. Differential Revision: https://reviews.llvm.org/D47157 rdar://problem/37077034 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335375 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Warning for framework headers using double quote includes"Bruno Cardoso Lopes2018-06-211-64/+1
| | | | | | | | | | | This reverts commit 9b5ff2db7e31c4bb11a7d468260b068b41c7c285. Broke bots: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315 http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335195 91177308-0d34-0410-b5e6-96231b3b80d8
* Warning for framework headers using double quote includesBruno Cardoso Lopes2018-06-201-1/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce -Wquoted-include-in-framework-header, which should fire a warning whenever a quote include appears in a framework header and suggest a fix-it. For instance, for header A.h added in the tests, this is how the warning looks like: ./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header] #include "A0.h" ^~~~~~ <A/A0.h> ./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header] #include "B.h" ^~~~~ <B.h> This helps users to prevent frameworks from using local headers when in fact they should be targetting system level ones. The warning is off by default. Differential Revision: https://reviews.llvm.org/D47157 rdar://problem/37077034 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335184 91177308-0d34-0410-b5e6-96231b3b80d8