Re: r338732 - [analyzer] Make RegionVector use const reference
On 2018-08-07, David Blaikie wrote: Looks good! Though it may be useful in the future to describe, in the commit message, the motivation for a change - how'd you find this? What motivated you to make this particular fix just now, etc? ("identified using clang-tidy" or "spotted during post-commit review of change r", etc...) Thanks for the tip! Will try to do this next time. On Thu, Aug 2, 2018 at 9:29 AM Fangrui Song via cfe-commits < cfe-commits@lists.llvm.org> wrote: Author: maskray Date: Thu Aug 2 09:29:36 2018 New Revision: 338732 URL: http://llvm.org/viewvc/llvm-project?rev=338732&view=rev Log: [analyzer] Make RegionVector use const reference Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ BugReporterVisitors.cpp?rev=338732&r1=338731&r2=338732&view=diff === === --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Thu Aug 2 09:29:36 2018 @@ -395,7 +395,7 @@ private: const Optional findRegionOfInterestInRecord(const RecordDecl *RD, ProgramStateRef State, const MemRegion *R, - RegionVector Vec = {}, + const RegionVector &Vec = {}, int depth = 0) { if (depth == DEREFERENCE_LIMIT) // Limit the recursion depth. @@ -548,14 +548,10 @@ private: /// \return Diagnostics piece for region not modified in the current function. std::shared_ptr - notModifiedDiagnostics(const LocationContext *Ctx, - CallExitBegin &CallExitLoc, - CallEventRef<> Call, - RegionVector FieldChain, - const MemRegion *MatchedRegion, - StringRef FirstElement, - bool FirstIsReferenceType, - unsigned IndirectionLevel) { + notModifiedDiagnostics(const LocationContext *Ctx, CallExitBegin & CallExitLoc, + CallEventRef<> Call, const RegionVector & FieldChain, + const MemRegion *MatchedRegion, StringRef FirstElement, + bool FirstIsReferenceType, unsigned IndirectionLevel) { PathDiagnosticLocation L; if (const ReturnStmt *RS = CallExitLoc.getReturnStmt()) { @@ -579,7 +575,8 @@ private: /// Pretty-print region \p MatchedRegion to \p os. void prettyPrintRegionName(StringRef FirstElement, bool FirstIsReferenceType, const MemRegion *MatchedRegion, - RegionVector FieldChain, int IndirectionLevel, + const RegionVector &FieldChain, + int IndirectionLevel, llvm::raw_svector_ostream &os) { if (FirstIsReferenceType) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits -- 宋方睿 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D50154: [clangd] capitalize diagnostic messages
It might be useful to know what other editors do here to know whether this should be a client transformation or baked into the server. Vim syntastic/ale, Emacs flycheck do not seem to do such transformation. What's the editor you are using? On 2018-08-07, Alex L wrote: On Tue, 7 Aug 2018 at 10:52, David Blaikie via cfe-commits < cfe-commits@lists.llvm.org> wrote: On Tue, Aug 7, 2018 at 10:33 AM Alex Lorenz via Phabricator < revi...@reviews.llvm.org> wrote: arphaman added a comment. In https://reviews.llvm.org/D50154#1191002, @dblaikie wrote: > What's the motivation for clangd to differ from clang here? (& if the first > letter is going to be capitalized, should there be a period at the end? But > also the phrasing of most/all diagnostic text isn't in the form of complete > sentences, so this might not make sense) It's mostly for the presentation purposes, to match the needs of our client. I first implemented it as an opt-in feature, but the consensus was to capitalize the messages all the time. Doesn't seem like it'd be any more expensive (amount of code or performance) to do that up in your client code, then, would it? I guess if most users of this API in time ended up preferring capitalized values, it'd make sense to share that implementation - but to me it seems like a strange transformation to happen at this level. (since it depends on what kind of client/how they want to render things - so it seems an odd choice to bake in to the API (or even provide an option for, unless there are lots of users/the code was especially complicated)) My 2c - I've no vested interest or authority here. I think it's more in spirit with Clangd to provide output that's as close to the one presented by the client as possible. I would argue there's already a precedence for this kind of transformations, for example, Clangd merges the diagnostic messages of notes and the main diagnostics into one, to make it a better presentation experience in the client: https://github.com/llvm-mirror/clang-tools-extra/blob/ 55bfabcc1bd75447d6338ffe6ff27c1624a8c15a/clangd/Diagnostics.cpp#L161 I don't think it would make sense to insert the period at the end, because, as you said, not all diagnostics are complete sentences Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D50154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits -- 宋方睿 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D50154: [clangd] capitalize diagnostic messages
On 2018-08-07, David Blaikie wrote: On Tue, Aug 7, 2018 at 4:02 PM Alex L wrote: On Tue, 7 Aug 2018 at 11:38, David Blaikie wrote: On Tue, Aug 7, 2018 at 11:22 AM Alex L wrote: On Tue, 7 Aug 2018 at 10:52, David Blaikie via cfe-commits < cfe-commits@lists.llvm.org> wrote: On Tue, Aug 7, 2018 at 10:33 AM Alex Lorenz via Phabricator < revi...@reviews.llvm.org> wrote: arphaman added a comment. In https://reviews.llvm.org/D50154#1191002, @dblaikie wrote: > What's the motivation for clangd to differ from clang here? (& if the first > letter is going to be capitalized, should there be a period at the end? But > also the phrasing of most/all diagnostic text isn't in the form of complete > sentences, so this might not make sense) It's mostly for the presentation purposes, to match the needs of our client. I first implemented it as an opt-in feature, but the consensus was to capitalize the messages all the time. Doesn't seem like it'd be any more expensive (amount of code or performance) to do that up in your client code, then, would it? I guess if most users of this API in time ended up preferring capitalized values, it'd make sense to share that implementation - but to me it seems like a strange transformation to happen at this level. (since it depends on what kind of client/how they want to render things - so it seems an odd choice to bake in to the API (or even provide an option for, unless there are lots of users/the code was especially complicated)) My 2c - I've no vested interest or authority here. I think it's more in spirit with Clangd to provide output that's as close to the one presented by the client as possible. That assumes there's one client though, right? Different clients might reasonably have different needs for how they'd want the text rendered, I'd imagine. True. This transformation is lossless though, so the clients will still be able to get back the original text if needed. I'm not sure that c == lower(upper(c)) - well, if the character is ever uppercase to begin with, it's clearly not. But even in the case of a lowercase character to start with I didn't think that was always true - I guess for ASCII /English it is, and that's all we're dealing with here. Not bijection :) classical German example 'ß'.upper().lower() => 'ss' Though for the context (diagnostic messages where i18n is not concerned), this works well enough. And if the consensus about this particular text transformation changes I'm willing to revert this change for sure. *nod* I mean if everyone who's invested in/working on clangd agrees with your direction, that's cool/good. My 2c is that this sort of thing seems like the responsibility of the client, not the API - but that's by no means authoritative. Alex, would you mind sharing the discussion thread of the editor you use? I would argue there's already a precedence for this kind of transformations, for example, Clangd merges the diagnostic messages of notes and the main diagnostics into one, to make it a better presentation experience in the client: https://github.com/llvm-mirror/clang-tools-extra/blob/ 55bfabcc1bd75447d6338ffe6ff27c1624a8c15a/clangd/Diagnostics.cpp# L161 I'm assuming that's because the API/protocol only supports a single message, so the multi-message/location nuance of LLVM's diagnostics are necessarily lost when converting to that format? If that's not the case, and the API/protocol does support a multiple-message diagnostic & ClangD is collapsing them early - that also seems like an unfortunate loss in fidelity. Clangd sends out both the main diagnostic, and the attached notes (that don't have fixits) in a list (i.e. the hierarchy isn't directly preserved, although it can be recreated by the client). So it looks like they're collapsed early, but at the same time the client has enough information to do this transformation itself if desired. I'm planning to work on an option to remove this behavior if desired by the client. *nod* I'd (completely in the abstract - not having worked on clangd or its clients, so take with grain of salt, etc) probably still leave this up to the client (which would be easier if the client were an in-process API kind of thing rather than a strict protocol - because it'd be easy to include a function clients could cal
r340145 - [Lex] Fix some inconsistent parameter names and duplicate comments. NFC
Author: maskray Date: Sun Aug 19 15:23:42 2018 New Revision: 340145 URL: http://llvm.org/viewvc/llvm-project?rev=340145&view=rev Log: [Lex] Fix some inconsistent parameter names and duplicate comments. NFC Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h cfe/trunk/include/clang/Lex/HeaderSearch.h cfe/trunk/include/clang/Lex/Lexer.h cfe/trunk/include/clang/Lex/ModuleMap.h cfe/trunk/include/clang/Lex/Pragma.h cfe/trunk/include/clang/Lex/Preprocessor.h cfe/trunk/include/clang/Lex/PreprocessorLexer.h cfe/trunk/include/clang/Lex/TokenLexer.h Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=340145&r1=340144&r2=340145&view=diff == --- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original) +++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Sun Aug 19 15:23:42 2018 @@ -191,7 +191,7 @@ private: SmallVectorImpl *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule, - bool &InUserSpecifiedSystemHeader) const; + bool &InUserSpecifiedSystemFramework) const; }; Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=340145&r1=340144&r2=340145&view=diff == --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original) +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Sun Aug 19 15:23:42 2018 @@ -55,7 +55,7 @@ struct HeaderFileInfo { /// True if this is a \#pragma once file. unsigned isPragmaOnce : 1; - /// DirInfo - Keep track of whether this is a system header, and if so, + /// Keep track of whether this is a system header, and if so, /// whether it is C++ clean or not. This can be set by the include paths or /// by \#pragma gcc system_header. This is an instance of /// SrcMgr::CharacteristicKind. @@ -219,14 +219,14 @@ class HeaderSearch { /// name like "Carbon" to the Carbon.framework directory. llvm::StringMap FrameworkMap; - /// IncludeAliases - maps include file names (including the quotes or + /// Maps include file names (including the quotes or /// angle brackets) to other include file names. This is used to support the /// include_alias pragma for Microsoft compatibility. using IncludeAliasMap = llvm::StringMap; std::unique_ptr IncludeAliases; - /// HeaderMaps - This is a mapping from FileEntry -> HeaderMap, uniquing + /// This is a mapping from FileEntry -> HeaderMap, uniquing /// headermaps. This vector owns the headermap. std::vector> HeaderMaps; @@ -314,7 +314,7 @@ public: (*IncludeAliases)[Source] = Dest; } - /// MapHeaderToIncludeAlias - Maps one header file name to a different header + /// Maps one header file name to a different header /// file name, for use with the include_alias pragma. Note that the source /// file name should include the angle brackets or quotes. Returns StringRef /// as null if the header cannot be mapped. @@ -408,7 +408,7 @@ public: /// HIToolbox is a subframework within Carbon.framework. If so, return /// the FileEntry for the designated file, otherwise return null. const FileEntry *LookupSubframeworkHeader( - StringRef Filename, const FileEntry *RelativeFileEnt, + StringRef Filename, const FileEntry *ContextFileEnt, SmallVectorImpl *SearchPath, SmallVectorImpl *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule); @@ -425,7 +425,7 @@ public: /// if we should include it. bool ShouldEnterIncludeFile(Preprocessor &PP, const FileEntry *File, bool isImport, bool ModulesEnabled, - Module *CorrespondingModule); + Module *M); /// Return whether the specified file is a normal header, /// a system header, or a C++ friendly system header. @@ -448,9 +448,9 @@ public: } /// Mark the specified file as part of a module. - void MarkFileModuleHeader(const FileEntry *File, + void MarkFileModuleHeader(const FileEntry *FE, ModuleMap::ModuleHeaderRole Role, -bool IsCompiledModuleHeader); +bool isCompilingModuleHeader); /// Increment the count for the number of times the specified /// FileEntry has been entered. @@ -479,7 +479,7 @@ public: /// This routine does not consider the effect of \#import bool isFileMultipleIncludeGuarded(const FileEntry *File); - /// CreateHeaderMap - This method returns a HeaderMap for the specified + /// This method returns a HeaderMap for the specified /// FileEntry, uniquing them through the 'HeaderMaps' datastructure. const HeaderMap *CreateHeaderMap(const FileEntry *FE); @@ -6
r340198 - [Lex] Make HeaderMaps a unique_ptr vector
Author: maskray Date: Mon Aug 20 12:15:02 2018 New Revision: 340198 URL: http://llvm.org/viewvc/llvm-project?rev=340198&view=rev Log: [Lex] Make HeaderMaps a unique_ptr vector 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 Modified: cfe/trunk/include/clang/Lex/HeaderMap.h cfe/trunk/include/clang/Lex/HeaderSearch.h cfe/trunk/lib/Lex/HeaderMap.cpp cfe/trunk/lib/Lex/HeaderSearch.cpp Modified: cfe/trunk/include/clang/Lex/HeaderMap.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderMap.h?rev=340198&r1=340197&r2=340198&view=diff == --- cfe/trunk/include/clang/Lex/HeaderMap.h (original) +++ cfe/trunk/include/clang/Lex/HeaderMap.h Mon Aug 20 12:15:02 2018 @@ -71,7 +71,8 @@ class HeaderMap : private HeaderMapImpl public: /// This attempts to load the specified file as a header map. If it doesn't /// look like a HeaderMap, it gives up and returns null. - static const HeaderMap *Create(const FileEntry *FE, FileManager &FM); + static std::unique_ptr Create(const FileEntry *FE, + FileManager &FM); /// Check to see if the specified relative filename is located in this /// HeaderMap. If so, open it and return its FileEntry. If RawPath is not Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=340198&r1=340197&r2=340198&view=diff == --- cfe/trunk/include/clang/Lex/HeaderSearch.h (original) +++ cfe/trunk/include/clang/Lex/HeaderSearch.h Mon Aug 20 12:15:02 2018 @@ -17,6 +17,7 @@ #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "clang/Lex/DirectoryLookup.h" +#include "clang/Lex/HeaderMap.h" #include "clang/Lex/ModuleMap.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" @@ -38,7 +39,6 @@ class DirectoryEntry; class ExternalPreprocessorSource; class FileEntry; class FileManager; -class HeaderMap; class HeaderSearchOptions; class IdentifierInfo; class LangOptions; @@ -226,9 +226,8 @@ class HeaderSearch { llvm::StringMap; std::unique_ptr IncludeAliases; - /// This is a mapping from FileEntry -> HeaderMap, uniquing - /// headermaps. This vector owns the headermap. - std::vector> HeaderMaps; + /// This is a mapping from FileEntry -> HeaderMap, uniquing headermaps. + std::vector>> HeaderMaps; /// The mapping between modules and headers. mutable ModuleMap ModMap; @@ -264,7 +263,6 @@ public: const LangOptions &LangOpts, const TargetInfo *Target); HeaderSearch(const HeaderSearch &) = delete; HeaderSearch &operator=(const HeaderSearch &) = delete; - ~HeaderSearch(); /// Retrieve the header-search options with which this header search /// was initialized. Modified: cfe/trunk/lib/Lex/HeaderMap.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderMap.cpp?rev=340198&r1=340197&r2=340198&view=diff == --- cfe/trunk/lib/Lex/HeaderMap.cpp (original) +++ cfe/trunk/lib/Lex/HeaderMap.cpp Mon Aug 20 12:15:02 2018 @@ -48,7 +48,8 @@ static inline unsigned HashHMapKey(Strin /// map. If it doesn't look like a HeaderMap, it gives up and returns null. /// If it looks like a HeaderMap but is obviously corrupted, it puts a reason /// into the string error argument and returns null. -const HeaderMap *HeaderMap::Create(const FileEntry *FE, FileManager &FM) { +std::unique_ptr HeaderMap::Create(const FileEntry *FE, + FileManager &FM) { // If the file is too small to be a header map, ignore it. unsigned FileSize = FE->getSize(); if (FileSize <= sizeof(HMapHeader)) return nullptr; @@ -59,7 +60,7 @@ const HeaderMap *HeaderMap::Create(const bool NeedsByteSwap; if (!checkHeader(**FileBuffer, NeedsByteSwap)) return nullptr; - return new HeaderMap(std::move(*FileBuffer), NeedsByteSwap); + return std::unique_ptr(new HeaderMap(std::move(*FileBuffer), NeedsByteSwap)); } bool HeaderMapImpl::checkHeader(const llvm::MemoryBuffer &File, Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=340198&r1=340197&r2=340198&view=diff == --- cfe/trunk/lib/Lex/HeaderSearch.cpp (original) +++ cfe/trunk/lib/Lex/HeaderSearch.cpp Mon Aug 20 12:15:02 2018 @@ -75,12 +75,6 @@ HeaderSearch::HeaderSearch(std::shared_p FileMgr(SourceMgr.getFileManager()), FrameworkMap(64), ModMap(SourceMgr, Diags, LangOpts, Target, *this) {} -HeaderSearch::~HeaderSear
r333352 - [DebugInfo] Fix typo. NFC
Author: maskray Date: Sun May 27 00:23:04 2018 New Revision: 52 URL: http://llvm.org/viewvc/llvm-project?rev=52&view=rev Log: [DebugInfo] Fix typo. NFC Modified: cfe/trunk/include/clang/Basic/DebugInfoOptions.h Modified: cfe/trunk/include/clang/Basic/DebugInfoOptions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DebugInfoOptions.h?rev=52&r1=51&r2=52&view=diff == --- cfe/trunk/include/clang/Basic/DebugInfoOptions.h (original) +++ cfe/trunk/include/clang/Basic/DebugInfoOptions.h Sun May 27 00:23:04 2018 @@ -28,7 +28,7 @@ enum DebugInfoKind { /// forward decls for types that could be /// replaced with forward decls in the source /// code. For dynamic C++ classes type info - /// is only emitted int the module that + /// is only emitted into the module that /// contains the classe's vtable. FullDebugInfo/// Generate complete debug info. }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r340709 - [Driver] Change MipsLinux default linker from "lld" to "ld.lld"
Author: maskray Date: Sun Aug 26 12:47:23 2018 New Revision: 340709 URL: http://llvm.org/viewvc/llvm-project?rev=340709&view=rev Log: [Driver] Change MipsLinux default linker from "lld" to "ld.lld" Reviewers: kzhuravl, atanasyan Reviewed By: atanasyan Subscribers: sdardis, arichardson, jrtc27, atanasyan, cfe-commits Differential Revision: https://reviews.llvm.org/D51234 Modified: cfe/trunk/lib/Driver/ToolChains/MipsLinux.h Modified: cfe/trunk/lib/Driver/ToolChains/MipsLinux.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MipsLinux.h?rev=340709&r1=340708&r2=340709&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MipsLinux.h (original) +++ cfe/trunk/lib/Driver/ToolChains/MipsLinux.h Sun Aug 26 12:47:23 2018 @@ -49,7 +49,7 @@ public: } const char *getDefaultLinker() const override { -return "lld"; +return "ld.lld"; } private: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r340845 - [Driver] Delete last reference of lld -flavor old-gnu
Author: maskray Date: Tue Aug 28 10:20:28 2018 New Revision: 340845 URL: http://llvm.org/viewvc/llvm-project?rev=340845&view=rev Log: [Driver] Delete last reference of lld -flavor old-gnu This is dead code because lld -flavor old-gnu was removed in 2016 by rLLD262158. Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=340845&r1=340844&r2=340845&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Aug 28 10:20:28 2018 @@ -323,14 +323,6 @@ void tools::gnutools::Linker::ConstructJ // handled somewhere else. Args.ClaimAllArgs(options::OPT_w); - const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); - if (llvm::sys::path::stem(Exec) == "lld") { -CmdArgs.push_back("-flavor"); -CmdArgs.push_back("old-gnu"); -CmdArgs.push_back("-target"); -CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString())); - } - if (!D.SysRoot.empty()) CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); @@ -539,6 +531,7 @@ void tools::gnutools::Linker::ConstructJ AddHIPLinkerScript(getToolChain(), C, Output, Inputs, Args, CmdArgs, JA, *this); + const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs)); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r341151 - Import lit.llvm after rC341132
Author: maskray Date: Thu Aug 30 17:24:36 2018 New Revision: 341151 URL: http://llvm.org/viewvc/llvm-project?rev=341151&view=rev Log: Import lit.llvm after rC341132 Modified: cfe/trunk/test/lit.site.cfg.py.in Modified: cfe/trunk/test/lit.site.cfg.py.in URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.site.cfg.py.in?rev=341151&r1=341150&r2=341151&view=diff == --- cfe/trunk/test/lit.site.cfg.py.in (original) +++ cfe/trunk/test/lit.site.cfg.py.in Thu Aug 30 17:24:36 2018 @@ -40,7 +40,7 @@ except KeyError: key, = e.args lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) -import lit +import lit.llvm lit.llvm.initialize(lit_config, config) # Let the main config do the real work. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r341152 - Import lit.llvm after rL341130
Author: maskray Date: Thu Aug 30 17:26:46 2018 New Revision: 341152 URL: http://llvm.org/viewvc/llvm-project?rev=341152&view=rev Log: Import lit.llvm after rL341130 Modified: clang-tools-extra/trunk/test/lit.site.cfg.in Modified: clang-tools-extra/trunk/test/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.in?rev=341152&r1=341151&r2=341152&view=diff == --- clang-tools-extra/trunk/test/lit.site.cfg.in (original) +++ clang-tools-extra/trunk/test/lit.site.cfg.in Thu Aug 30 17:26:46 2018 @@ -23,7 +23,7 @@ except KeyError: key, = e.args lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key)) -import lit +import lit.llvm lit.llvm.initialize(lit_config, config) # Let the main config do the real work. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r341273 - [clangd] Fix many typos. NFC
Author: maskray Date: Sat Sep 1 00:47:03 2018 New Revision: 341273 URL: http://llvm.org/viewvc/llvm-project?rev=341273&view=rev Log: [clangd] Fix many typos. NFC Modified: clang-tools-extra/trunk/clangd/Logger.h clang-tools-extra/trunk/clangd/index/FileIndex.h clang-tools-extra/trunk/clangd/index/Index.cpp clang-tools-extra/trunk/clangd/index/Index.h clang-tools-extra/trunk/clangd/index/MemIndex.cpp clang-tools-extra/trunk/clangd/index/Merge.cpp clang-tools-extra/trunk/clangd/index/Merge.h clang-tools-extra/trunk/clangd/index/SymbolCollector.h clang-tools-extra/trunk/clangd/index/dex/Trigram.h Modified: clang-tools-extra/trunk/clangd/Logger.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Logger.h?rev=341273&r1=341272&r2=341273&view=diff == --- clang-tools-extra/trunk/clangd/Logger.h (original) +++ clang-tools-extra/trunk/clangd/Logger.h Sat Sep 1 00:47:03 2018 @@ -56,7 +56,7 @@ void log(Logger::Level L, const char *Fm template void elog(const char *Fmt, Ts &&... Vals) { detail::log(Logger::Error, Fmt, std::forward(Vals)...); } -// log() is used for information important to understanding a clangd session. +// log() is used for information important to understand a clangd session. // e.g. the names of LSP messages sent are logged at this level. // This level could be enabled in production builds to allow later inspection. template void log(const char *Fmt, Ts &&... Vals) { Modified: clang-tools-extra/trunk/clangd/index/FileIndex.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/FileIndex.h?rev=341273&r1=341272&r2=341273&view=diff == --- clang-tools-extra/trunk/clangd/index/FileIndex.h (original) +++ clang-tools-extra/trunk/clangd/index/FileIndex.h Sat Sep 1 00:47:03 2018 @@ -36,7 +36,7 @@ namespace clangd { /// the snapshot, either this class or the symbol index. /// /// The snapshot semantics keeps critical sections minimal since we only need -/// locking when we swap or obtain refereces to snapshots. +/// locking when we swap or obtain references to snapshots. class FileSymbols { public: /// \brief Updates all symbols and occurrences in a file. @@ -60,7 +60,7 @@ private: llvm::StringMap> FileToOccurrenceSlabs; }; -/// \brief This manages symbls from files and an in-memory index on all symbols. +/// \brief This manages symbols from files and an in-memory index on all symbols. class FileIndex : public SymbolIndex { public: /// If URISchemes is empty, the default schemes in SymbolCollector will be Modified: clang-tools-extra/trunk/clangd/index/Index.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.cpp?rev=341273&r1=341272&r2=341273&view=diff == --- clang-tools-extra/trunk/clangd/index/Index.cpp (original) +++ clang-tools-extra/trunk/clangd/index/Index.cpp Sat Sep 1 00:47:03 2018 @@ -152,7 +152,7 @@ void SymbolOccurrenceSlab::insert(const } void SymbolOccurrenceSlab::freeze() { - // Deduplicate symbol occurrenes. + // Deduplicate symbol occurrences. for (auto &IDAndOccurrence : Occurrences) { auto &Occurrence = IDAndOccurrence.getSecond(); std::sort(Occurrence.begin(), Occurrence.end()); Modified: clang-tools-extra/trunk/clangd/index/Index.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Index.h?rev=341273&r1=341272&r2=341273&view=diff == --- clang-tools-extra/trunk/clangd/index/Index.h (original) +++ clang-tools-extra/trunk/clangd/index/Index.h Sat Sep 1 00:47:03 2018 @@ -456,7 +456,7 @@ public: /// CrossReference finds all symbol occurrences (e.g. references, /// declarations, definitions) and applies \p Callback on each result. /// - /// Resutls are returned in arbitrary order. + /// Results are returned in arbitrary order. /// /// The returned result must be deep-copied if it's used outside Callback. virtual void findOccurrences( Modified: clang-tools-extra/trunk/clangd/index/MemIndex.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/MemIndex.cpp?rev=341273&r1=341272&r2=341273&view=diff == --- clang-tools-extra/trunk/clangd/index/MemIndex.cpp (original) +++ clang-tools-extra/trunk/clangd/index/MemIndex.cpp Sat Sep 1 00:47:03 2018 @@ -44,7 +44,7 @@ void MemIndex::build(std::shared_ptr Lock(Mutex); Index = std::move(TempIndex); -Symbols = std::move(Syms); // Relase old symbols. +Symbols = std::move(Syms); // Release old symbols. Occurrences = std::move(AllOccurrences); } Modified: clang-tools-extra/trunk/clangd/index/Merge.cpp URL: ht
[clang-tools-extra] r341452 - [clangd] Fix typo. NFC
Author: maskray Date: Wed Sep 5 01:01:37 2018 New Revision: 341452 URL: http://llvm.org/viewvc/llvm-project?rev=341452&view=rev Log: [clangd] Fix typo. NFC Modified: clang-tools-extra/trunk/clangd/Cancellation.h clang-tools-extra/trunk/clangd/CodeComplete.cpp clang-tools-extra/trunk/clangd/FindSymbols.cpp clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp Modified: clang-tools-extra/trunk/clangd/Cancellation.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Cancellation.h?rev=341452&r1=341451&r2=341452&view=diff == --- clang-tools-extra/trunk/clangd/Cancellation.h (original) +++ clang-tools-extra/trunk/clangd/Cancellation.h Wed Sep 5 01:01:37 2018 @@ -93,7 +93,7 @@ public: /// extra lookups in the Context. bool isCancelled() const { return CT; } - /// Creates a task handle that can be used by an asyn task to check for + /// Creates a task handle that can be used by an async task to check for /// information that can change during it's runtime, like Cancellation. static std::shared_ptr createHandle() { return std::shared_ptr(new Task()); Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=341452&r1=341451&r2=341452&view=diff == --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Wed Sep 5 01:01:37 2018 @@ -1629,7 +1629,7 @@ CompletionItem CodeCompletion::render(co LSP.sortText = sortText(Score.Total, Name); LSP.filterText = Name; LSP.textEdit = {CompletionTokenRange, RequiredQualifier + Name}; - // Merge continious additionalTextEdits into main edit. The main motivation + // Merge continuous additionalTextEdits into main edit. The main motivation // behind this is to help LSP clients, it seems most of them are confused when // they are provided with additionalTextEdits that are consecutive to main // edit. Modified: clang-tools-extra/trunk/clangd/FindSymbols.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FindSymbols.cpp?rev=341452&r1=341451&r2=341452&view=diff == --- clang-tools-extra/trunk/clangd/FindSymbols.cpp (original) +++ clang-tools-extra/trunk/clangd/FindSymbols.cpp Wed Sep 5 01:01:37 2018 @@ -226,7 +226,7 @@ public: // We should be only be looking at "local" decls in the main file. if (!SourceMgr.isWrittenInMainFile(NameLoc)) { // Even thought we are visiting only local (non-preamble) decls, - // we can get here when in the presense of "extern" decls. + // we can get here when in the presence of "extern" decls. return true; } const NamedDecl *ND = llvm::dyn_cast(ASTNode.OrigD); Modified: clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp?rev=341452&r1=341451&r2=341452&view=diff == --- clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp (original) +++ clang-tools-extra/trunk/clangd/JSONRPCDispatcher.cpp Wed Sep 5 01:01:37 2018 @@ -28,7 +28,7 @@ namespace { static Key RequestID; static Key RequestOut; -// When tracing, we trace a request and attach the repsonse in reply(). +// When tracing, we trace a request and attach the response in reply(). // Because the Span isn't available, we find the current request using Context. class RequestSpan { RequestSpan(llvm::json::Object *Args) : Args(Args) {} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r341756 - [Parser] Remove an unnecessary `mutable`
Author: maskray Date: Sat Sep 8 18:54:18 2018 New Revision: 341756 URL: http://llvm.org/viewvc/llvm-project?rev=341756&view=rev Log: [Parser] Remove an unnecessary `mutable` Modified: cfe/trunk/include/clang/Parse/Parser.h Modified: cfe/trunk/include/clang/Parse/Parser.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=341756&r1=341755&r2=341756&view=diff == --- cfe/trunk/include/clang/Parse/Parser.h (original) +++ cfe/trunk/include/clang/Parse/Parser.h Sat Sep 8 18:54:18 2018 @@ -119,7 +119,7 @@ class Parser : public CodeCompletionHand IdentifierInfo *Ident_pixel; /// Objective-C contextual keywords. - mutable IdentifierInfo *Ident_instancetype; + IdentifierInfo *Ident_instancetype; /// Identifier for "introduced". IdentifierInfo *Ident_introduced; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r341763 - [Sema] Make typo correction slightly more efficient
Author: maskray Date: Sun Sep 9 10:20:03 2018 New Revision: 341763 URL: http://llvm.org/viewvc/llvm-project?rev=341763&view=rev Log: [Sema] Make typo correction slightly more efficient edit_distance returns UpperBound+1 if the distance will exceed UpperBound. We can subtract 1 from UpperBound and change >= to > in the if condition. The threshold does not change but edit_distance will have more opportunity to bail out earlier. Modified: cfe/trunk/lib/Sema/SemaLookup.cpp Modified: cfe/trunk/lib/Sema/SemaLookup.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=341763&r1=341762&r2=341763&view=diff == --- cfe/trunk/lib/Sema/SemaLookup.cpp (original) +++ cfe/trunk/lib/Sema/SemaLookup.cpp Sun Sep 9 10:20:03 2018 @@ -3998,9 +3998,9 @@ void TypoCorrectionConsumer::addName(Str // Compute an upper bound on the allowable edit distance, so that the // edit-distance algorithm can short-circuit. - unsigned UpperBound = (TypoStr.size() + 2) / 3 + 1; + unsigned UpperBound = (TypoStr.size() + 2) / 3; unsigned ED = TypoStr.edit_distance(Name, true, UpperBound); - if (ED >= UpperBound) return; + if (ED > UpperBound) return; TypoCorrection TC(&SemaRef.Context.Idents.get(Name), ND, NNS, ED); if (isKeyword) TC.makeKeyword(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r342198 - [clangd] Fix TUScheduler typos
Author: maskray Date: Thu Sep 13 17:56:11 2018 New Revision: 342198 URL: http://llvm.org/viewvc/llvm-project?rev=342198&view=rev Log: [clangd] Fix TUScheduler typos Modified: clang-tools-extra/trunk/clangd/TUScheduler.cpp clang-tools-extra/trunk/clangd/TUScheduler.h Modified: clang-tools-extra/trunk/clangd/TUScheduler.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/TUScheduler.cpp?rev=342198&r1=342197&r2=342198&view=diff == --- clang-tools-extra/trunk/clangd/TUScheduler.cpp (original) +++ clang-tools-extra/trunk/clangd/TUScheduler.cpp Thu Sep 13 17:56:11 2018 @@ -18,7 +18,7 @@ // preamble. However, unlike AST, the same preamble can be read concurrently, so // we run each of async preamble reads on its own thread. // -// To limit the concurrent load that clangd produces we mantain a semaphore that +// To limit the concurrent load that clangd produces we maintain a semaphore that // keeps more than a fixed number of threads from running concurrently. // // Rationale for cancelling updates. @@ -165,7 +165,7 @@ public: /// The processing thread is spawned using \p Tasks. However, when \p Tasks /// is null, all requests will be processed on the calling thread /// synchronously instead. \p Barrier is acquired when processing each - /// request, it is be used to limit the number of actively running threads. + /// request, it is used to limit the number of actively running threads. static ASTWorkerHandle create(PathRef FileName, TUScheduler::ASTCache &IdleASTs, AsyncTaskRunner *Tasks, Semaphore &Barrier, @@ -188,7 +188,7 @@ public: void getCurrentPreamble( llvm::unique_function)>); /// Wait for the first build of preamble to finish. Preamble itself can be - /// accessed via getPossibleStalePreamble(). Note that this function will + /// accessed via getPossiblyStalePreamble(). Note that this function will /// return after an unsuccessful build of the preamble too, i.e. result of /// getPossiblyStalePreamble() can be null even after this function returns. void waitForFirstPreamble() const; @@ -207,7 +207,7 @@ private: void startTask(llvm::StringRef Name, llvm::unique_function Task, llvm::Optional UpdateType); /// Determines the next action to perform. - /// All actions that should never run are disarded. + /// All actions that should never run are discarded. /// Returns a deadline for the next action. If it's expired, run now. /// scheduleLocked() is called again at the deadline, or if requests arrive. Deadline scheduleLocked(); @@ -227,7 +227,7 @@ private: const bool RunSync; /// Time to wait after an update to see whether another update obsoletes it. const steady_clock::duration UpdateDebounce; - /// File that ASTWorker is reponsible for. + /// File that ASTWorker is responsible for. const Path FileName; /// Whether to keep the built preambles in memory or on disk. const bool StorePreambleInMemory; @@ -417,7 +417,7 @@ void ASTWorker::update( // We want to report the diagnostics even if this update was cancelled. // It seems more useful than making the clients wait indefinitely if they // spam us with updates. -// Note *AST can be still be null if buildAST fails. +// Note *AST can still be null if buildAST fails. if (*AST) { OnUpdated((*AST)->getDiagnostics()); trace::Span Span("Running main AST callback"); Modified: clang-tools-extra/trunk/clangd/TUScheduler.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/TUScheduler.h?rev=342198&r1=342197&r2=342198&view=diff == --- clang-tools-extra/trunk/clangd/TUScheduler.h (original) +++ clang-tools-extra/trunk/clangd/TUScheduler.h Thu Sep 13 17:56:11 2018 @@ -176,7 +176,7 @@ private: }; /// Runs \p Action asynchronously with a new std::thread. The context will be -/// propogated. +/// propagated. template std::future runAsync(llvm::unique_function Action) { return std::async(std::launch::async, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r342290 - test/Driver/output-file-cleanup.c: delete non-readable temporary file
Author: maskray Date: Fri Sep 14 14:36:35 2018 New Revision: 342290 URL: http://llvm.org/viewvc/llvm-project?rev=342290&view=rev Log: test/Driver/output-file-cleanup.c: delete non-readable temporary file %t-dir/2.c made tools (rsync, ripgrep, ...) sad (EACCES warning). Modified: cfe/trunk/test/Driver/output-file-cleanup.c Modified: cfe/trunk/test/Driver/output-file-cleanup.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/output-file-cleanup.c?rev=342290&r1=342289&r2=342290&view=diff == --- cfe/trunk/test/Driver/output-file-cleanup.c (original) +++ cfe/trunk/test/Driver/output-file-cleanup.c Fri Sep 14 14:36:35 2018 @@ -41,3 +41,4 @@ invalid C code // RUN: not %clang -S %t-dir/1.c %t-dir/2.c // RUN: test -f %t-dir/1.s // RUN: test ! -f %t-dir/2.s +// RUN: rm -f %t-dir/2.c ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337505 - [docs] Correct -fvisibility-inlines-hidden description
Author: maskray Date: Thu Jul 19 15:45:41 2018 New Revision: 337505 URL: http://llvm.org/viewvc/llvm-project?rev=337505&view=rev Log: [docs] Correct -fvisibility-inlines-hidden description Modified: cfe/trunk/docs/ClangCommandLineReference.rst cfe/trunk/include/clang/Driver/Options.td Modified: cfe/trunk/docs/ClangCommandLineReference.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=337505&r1=337504&r2=337505&view=diff == --- cfe/trunk/docs/ClangCommandLineReference.rst (original) +++ cfe/trunk/docs/ClangCommandLineReference.rst Thu Jul 19 15:45:41 2018 @@ -1928,7 +1928,7 @@ Enable the loop vectorization passes .. option:: -fvisibility-inlines-hidden -Give inline C++ member functions default visibility by default +Give inline C++ member functions hidden visibility by default .. option:: -fvisibility-ms-compat Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=337505&r1=337504&r2=337505&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Thu Jul 19 15:45:41 2018 @@ -1694,7 +1694,7 @@ def fverbose_asm : Flag<["-"], "fverbose def fvisibility_EQ : Joined<["-"], "fvisibility=">, Group, HelpText<"Set the default symbol visibility for all global declarations">, Values<"hidden,default">; def fvisibility_inlines_hidden : Flag<["-"], "fvisibility-inlines-hidden">, Group, - HelpText<"Give inline C++ member functions default visibility by default">, + HelpText<"Give inline C++ member functions hidden visibility by default">, Flags<[CC1Option]>; def fvisibility_ms_compat : Flag<["-"], "fvisibility-ms-compat">, Group, HelpText<"Give global types 'default' visibility and global functions and " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r337530 - Change \t to spaces
Author: maskray Date: Fri Jul 20 01:19:20 2018 New Revision: 337530 URL: http://llvm.org/viewvc/llvm-project?rev=337530&view=rev Log: Change \t to spaces Modified: cfe/trunk/include/clang-c/BuildSystem.h cfe/trunk/include/clang/Basic/Attr.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/arm_neon.td cfe/trunk/include/clang/Driver/CC1Options.td cfe/trunk/include/clang/Frontend/CodeGenOptions.def cfe/trunk/lib/AST/TypeLoc.cpp cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/CodeGen/CodeGenAction.cpp cfe/trunk/lib/Driver/Distro.cpp cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/lib/Sema/SemaDeclAttr.cpp cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/lib/Sema/SemaLambda.cpp cfe/trunk/lib/Sema/SemaLookup.cpp cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp Modified: cfe/trunk/include/clang-c/BuildSystem.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/BuildSystem.h?rev=337530&r1=337529&r2=337530&view=diff == --- cfe/trunk/include/clang-c/BuildSystem.h (original) +++ cfe/trunk/include/clang-c/BuildSystem.h Fri Jul 20 01:19:20 2018 @@ -66,7 +66,7 @@ clang_VirtualFileOverlay_addFileMapping( */ CINDEX_LINKAGE enum CXErrorCode clang_VirtualFileOverlay_setCaseSensitivity(CXVirtualFileOverlay, - int caseSensitive); +int caseSensitive); /** * Write out the \c CXVirtualFileOverlay object to a char buffer. Modified: cfe/trunk/include/clang/Basic/Attr.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=337530&r1=337529&r2=337530&view=diff == --- cfe/trunk/include/clang/Basic/Attr.td (original) +++ cfe/trunk/include/clang/Basic/Attr.td Fri Jul 20 01:19:20 2018 @@ -1932,7 +1932,7 @@ def Target : InheritableAttr { // overall feature validity for the function with the rest of the // attributes on the function. if (Feature.startswith("fpmath=") || Feature.startswith("tune=")) - continue; + continue; // While we're here iterating check for a different target cpu. if (Feature.startswith("arch=")) { Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337530&r1=337529&r2=337530&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul 20 01:19:20 2018 @@ -9102,9 +9102,9 @@ def note_equivalent_internal_linkage_dec "declared here%select{ in module '%1'|}0">; def note_redefinition_modules_same_file : Note< - "'%0' included multiple times, additional include site in header from module '%1'">; + "'%0' included multiple times, additional include site in header from module '%1'">; def note_redefinition_include_same_file : Note< - "'%0' included multiple times, additional include site here">; + "'%0' included multiple times, additional include site here">; } let CategoryName = "Coroutines Issue" in { Modified: cfe/trunk/include/clang/Basic/arm_neon.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/arm_neon.td?rev=337530&r1=337529&r2=337530&view=diff == --- cfe/trunk/include/clang/Basic/arm_neon.td (original) +++ cfe/trunk/include/clang/Basic/arm_neon.td Fri Jul 20 01:19:20 2018 @@ -1438,12 +1438,12 @@ let ArchGuard = "defined(__ARM_FEATURE_F // Comparison let InstName = "vacge" in { - def VCAGEH : SInst<"vcage", "udd", "hQh">; - def VCALEH : SInst<"vcale", "udd", "hQh">; +def VCAGEH : SInst<"vcage", "udd", "hQh">; +def VCALEH : SInst<"vcale", "udd", "hQh">; } let InstName = "vacgt" in { def VCAGTH : SInst<"vcagt", "udd", "hQh">; - def VCALTH : SInst<"vcalt", "udd", "hQh">; +def VCALTH : SInst<"vcalt", "udd", "hQh">; } def VCEQH: SOpInst<"vceq", "udd", "hQh", OP_EQ>; def VCGEH: SOpInst<"vcge", "udd", "hQh", OP_GE>; Modified: cfe/trunk/include/clang/Driver/CC1Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=337530&r1=337529&r2=337530&view=diff
r337892 - cc1_main: fix -Wsign-compare on FreeBSD
Author: maskray Date: Tue Jul 24 23:57:31 2018 New Revision: 337892 URL: http://llvm.org/viewvc/llvm-project?rev=337892&view=rev Log: cc1_main: fix -Wsign-compare on FreeBSD Its __rlim_t is intentionally signed (__int64_t) because of legacy code that uses -1 for RLIM_INFINITY. Modified: cfe/trunk/tools/driver/cc1_main.cpp Modified: cfe/trunk/tools/driver/cc1_main.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=337892&r1=337891&r2=337892&view=diff == --- cfe/trunk/tools/driver/cc1_main.cpp (original) +++ cfe/trunk/tools/driver/cc1_main.cpp Tue Jul 24 23:57:31 2018 @@ -140,9 +140,11 @@ static void ensureSufficientStack() { // Increase the soft stack limit to our desired level, if necessary and // possible. - if (rlim.rlim_cur != RLIM_INFINITY && rlim.rlim_cur < DesiredStackSize) { + if (rlim.rlim_cur != RLIM_INFINITY && + rlim.rlim_cur < rlim_t(DesiredStackSize)) { // Try to allocate sufficient stack. -if (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_max >= DesiredStackSize) +if (rlim.rlim_max == RLIM_INFINITY || +rlim.rlim_max >= rlim_t(DesiredStackSize)) rlim.rlim_cur = DesiredStackSize; else if (rlim.rlim_cur == rlim.rlim_max) return; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r338183 - [CFG] Remove duplicate function/class names at the beginning of comments
Author: maskray Date: Fri Jul 27 17:48:05 2018 New Revision: 338183 URL: http://llvm.org/viewvc/llvm-project?rev=338183&view=rev Log: [CFG] Remove duplicate function/class names at the beginning of comments Some functions/classes have renamed while the comments still use the old names. Delete them per coding style. Also some whitespace cleanup. Modified: cfe/trunk/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h cfe/trunk/include/clang/Analysis/CFG.h cfe/trunk/include/clang/Analysis/CFGStmtMap.h cfe/trunk/lib/Analysis/CFGReachabilityAnalysis.cpp Modified: cfe/trunk/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h?rev=338183&r1=338182&r2=338183&view=diff == --- cfe/trunk/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h (original) +++ cfe/trunk/include/clang/Analysis/Analyses/CFGReachabilityAnalysis.h Fri Jul 27 17:48:05 2018 @@ -23,7 +23,7 @@ namespace clang { class CFG; class CFGBlock; - + // A class that performs reachability queries for CFGBlocks. Several internal // checks in this checker require reachability information. The requests all // tend to have a common destination, so we lazily do a predecessor search @@ -45,7 +45,7 @@ public: private: void mapReachability(const CFGBlock *Dst); }; - + } // namespace clang #endif // LLVM_CLANG_ANALYSIS_ANALYSES_CFGREACHABILITYANALYSIS_H Modified: cfe/trunk/include/clang/Analysis/CFG.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/CFG.h?rev=338183&r1=338182&r2=338183&view=diff == --- cfe/trunk/include/clang/Analysis/CFG.h (original) +++ cfe/trunk/include/clang/Analysis/CFG.h Fri Jul 27 17:48:05 2018 @@ -51,7 +51,7 @@ class FieldDecl; class LangOptions; class VarDecl; -/// CFGElement - Represents a top-level expression in a basic block. +/// Represents a top-level expression in a basic block. class CFGElement { public: enum Kind { @@ -144,9 +144,9 @@ protected: CFGStmt() = default; }; -/// CFGConstructor - Represents C++ constructor call. Maintains information -/// necessary to figure out what memory is being initialized by the -/// constructor expression. For now this is only used by the analyzer's CFG. +/// Represents C++ constructor call. Maintains information necessary to figure +/// out what memory is being initialized by the constructor expression. For now +/// this is only used by the analyzer's CFG. class CFGConstructor : public CFGStmt { public: explicit CFGConstructor(CXXConstructExpr *CE, const ConstructionContext *C) @@ -169,12 +169,12 @@ private: } }; -/// CFGCXXRecordTypedCall - Represents a function call that returns a C++ object -/// by value. This, like constructor, requires a construction context in order -/// to understand the storage of the returned object . In C such tracking is not -/// necessary because no additional effort is required for destroying the object -/// or modeling copy elision. Like CFGConstructor, this element is for now only -/// used by the analyzer's CFG. +/// Represents a function call that returns a C++ object by value. This, like +/// constructor, requires a construction context in order to understand the +/// storage of the returned object . In C such tracking is not necessary because +/// no additional effort is required for destroying the object or modeling copy +/// elision. Like CFGConstructor, this element is for now only used by the +/// analyzer's CFG. class CFGCXXRecordTypedCall : public CFGStmt { public: /// Returns true when call expression \p CE needs to be represented @@ -210,8 +210,8 @@ private: } }; -/// CFGInitializer - Represents C++ base or member initializer from -/// constructor's initialization list. +/// Represents C++ base or member initializer from constructor's initialization +/// list. class CFGInitializer : public CFGElement { public: explicit CFGInitializer(CXXCtorInitializer *initializer) @@ -231,7 +231,7 @@ private: } }; -/// CFGNewAllocator - Represents C++ allocator call. +/// Represents C++ allocator call. class CFGNewAllocator : public CFGElement { public: explicit CFGNewAllocator(const CXXNewExpr *S) @@ -349,8 +349,8 @@ private: } }; -/// CFGImplicitDtor - Represents C++ object destructor implicitly generated -/// by compiler on various occasions. +/// Represents C++ object destructor implicitly generated by compiler on various +/// occasions. class CFGImplicitDtor : public CFGElement { protected: CFGImplicitDtor() = default; @@ -373,9 +373,9 @@ private: } }; -/// CFGAutomaticObjDtor - Represents C++ object destructor implicitly generated -/// for automatic object or temporary bound to const reference at the point -/// of leaving its local scope. +/// Rep
r338732 - [analyzer] Make RegionVector use const reference
Author: maskray Date: Thu Aug 2 09:29:36 2018 New Revision: 338732 URL: http://llvm.org/viewvc/llvm-project?rev=338732&view=rev Log: [analyzer] Make RegionVector use const reference Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=338732&r1=338731&r2=338732&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Thu Aug 2 09:29:36 2018 @@ -395,7 +395,7 @@ private: const Optional findRegionOfInterestInRecord(const RecordDecl *RD, ProgramStateRef State, const MemRegion *R, - RegionVector Vec = {}, + const RegionVector &Vec = {}, int depth = 0) { if (depth == DEREFERENCE_LIMIT) // Limit the recursion depth. @@ -548,14 +548,10 @@ private: /// \return Diagnostics piece for region not modified in the current function. std::shared_ptr - notModifiedDiagnostics(const LocationContext *Ctx, - CallExitBegin &CallExitLoc, - CallEventRef<> Call, - RegionVector FieldChain, - const MemRegion *MatchedRegion, - StringRef FirstElement, - bool FirstIsReferenceType, - unsigned IndirectionLevel) { + notModifiedDiagnostics(const LocationContext *Ctx, CallExitBegin &CallExitLoc, + CallEventRef<> Call, const RegionVector &FieldChain, + const MemRegion *MatchedRegion, StringRef FirstElement, + bool FirstIsReferenceType, unsigned IndirectionLevel) { PathDiagnosticLocation L; if (const ReturnStmt *RS = CallExitLoc.getReturnStmt()) { @@ -579,7 +575,8 @@ private: /// Pretty-print region \p MatchedRegion to \p os. void prettyPrintRegionName(StringRef FirstElement, bool FirstIsReferenceType, const MemRegion *MatchedRegion, - RegionVector FieldChain, int IndirectionLevel, + const RegionVector &FieldChain, + int IndirectionLevel, llvm::raw_svector_ostream &os) { if (FirstIsReferenceType) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r324914 - [libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo
Author: maskray Date: Mon Feb 12 09:42:09 2018 New Revision: 324914 URL: http://llvm.org/viewvc/llvm-project?rev=324914&view=rev Log: [libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo 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 Modified: cfe/trunk/include/clang-c/Index.h cfe/trunk/include/clang/Index/IndexSymbol.h cfe/trunk/test/Index/index-refs.cpp cfe/trunk/test/Index/index-subscripting-literals.m cfe/trunk/tools/c-index-test/c-index-test.c cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp cfe/trunk/tools/libclang/CXIndexDataConsumer.h Modified: cfe/trunk/include/clang-c/Index.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=324914&r1=324913&r2=324914&view=diff == --- cfe/trunk/include/clang-c/Index.h (original) +++ cfe/trunk/include/clang-c/Index.h Mon Feb 12 09:42:09 2018 @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 47 +#define CINDEX_VERSION_MINOR 48 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 1) \ @@ -6092,6 +6092,9 @@ typedef struct { /** * \brief Data for IndexerCallbacks#indexEntityReference. + * + * This may be deprecated in a future version as this duplicates + * the \c CXSymbolRole_Implicit bit in \c CXSymbolRole. */ typedef enum { /** @@ -6106,6 +6109,25 @@ typedef enum { } CXIdxEntityRefKind; /** + * \brief Roles that are attributed to symbol occurrences. + * + * Internal: this currently mirrors low 9 bits of clang::index::SymbolRole with + * higher bits zeroed. These high bits may be exposed in the future. + */ +typedef enum { + CXSymbolRole_None = 0, + CXSymbolRole_Declaration = 1 << 0, + CXSymbolRole_Definition = 1 << 1, + CXSymbolRole_Reference = 1 << 2, + CXSymbolRole_Read = 1 << 3, + CXSymbolRole_Write = 1 << 4, + CXSymbolRole_Call = 1 << 5, + CXSymbolRole_Dynamic = 1 << 6, + CXSymbolRole_AddressOf = 1 << 7, + CXSymbolRole_Implicit = 1 << 8 +} CXSymbolRole; + +/** * \brief Data for IndexerCallbacks#indexEntityReference. */ typedef struct { @@ -6135,6 +6157,10 @@ typedef struct { * \brief Lexical container context of the reference. */ const CXIdxContainerInfo *container; + /** + * \brief Sets of symbol roles of the reference. + */ + CXSymbolRole role; } CXIdxEntityRefInfo; /** Modified: cfe/trunk/include/clang/Index/IndexSymbol.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/IndexSymbol.h?rev=324914&r1=324913&r2=324914&view=diff == --- cfe/trunk/include/clang/Index/IndexSymbol.h (original) +++ cfe/trunk/include/clang/Index/IndexSymbol.h Mon Feb 12 09:42:09 2018 @@ -89,6 +89,8 @@ enum class SymbolProperty : SymbolProper static const unsigned SymbolPropertyBitNum = 8; /// Set of roles that are attributed to symbol occurrences. +/// +/// Low 9 bits of clang-c/include/Index.h CXSymbolRole mirrors this enum. enum class SymbolRole : uint32_t { Declaration = 1 << 0, Definition = 1 << 1, Modified: cfe/trunk/test/Index/index-refs.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-refs.cpp?rev=324914&r1=324913&r2=324914&view=diff == --- cfe/trunk/test/Index/index-refs.cpp (original) +++ cfe/trunk/test/Index/index-refs.cpp Mon Feb 12 09:42:09 2018 @@ -67,6 +67,9 @@ struct S2 { void foo5() { struct S2 s = { .y = 1, .x = 4}; + s.y = s.x + 1; + (void)&foo3; + foo4(s.y); } int ginitlist[] = {EnumVal}; @@ -105,7 +108,7 @@ int ginitlist[] = {EnumVal}; // CHECK: [indexDeclaration]: kind: c++-class-template | name: TS | {{.*}} | loc: 47:8 // CHECK-NEXT: [indexDeclaration]: kind: struct-template-partial-spec | name: TS | USR: c:@SP>1#T@TS>#t0.0#I | {{.*}} | loc: 50:8 // CHECK-NEXT: [indexDeclaration]: kind: typedef | name: MyInt | USR: c:index-refs.cpp@SP>1#T@TS>#t0.0#I@T@MyInt | {{.*}} | loc: 51:15 | semantic-container: [TS:50:8] | lexical-container: [TS:50:8] -// CHECK-NEXT: [indexEntityReference]: kind: c++-class-template | name: TS | USR: c:@ST>2#T#T@TS | lang: C++ | cursor: TemplateRef=TS:47:8 | loc: 50:8 | :: <> | container: [TU] | refkind: direct +// CHECK-NEXT: [indexEntityReference]: kind: c++-class-template | name: T
[clang-tools-extra] r325272 - [clang-tidy] Add `readability-simd-intrinsics` check.
Author: maskray Date: Thu Feb 15 09:56:43 2018 New Revision: 325272 URL: http://llvm.org/viewvc/llvm-project?rev=325272&view=rev Log: [clang-tidy] Add `readability-simd-intrinsics` check. Summary: Many architectures provide SIMD operations (e.g. x86 SSE/AVX, Power AltiVec/VSX, ARM NEON). It is common that SIMD code implementing the same algorithm, is written in multiple target-dispatching pieces to optimize for different architectures or micro-architectures. The C++ standard proposal P0214 and its extensions cover many common SIMD operations. By migrating from target-dependent intrinsics to P0214 operations, the SIMD code can be simplified and pieces for different targets can be unified. Refer to http://wg21.link/p0214 for introduction and motivation for the data-parallel standard library. Subscribers: klimek, aemerson, mgorny, xazax.hun, kristof.beyls, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D42983 Added: clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/readability-simd-intrinsics.rst clang-tools-extra/trunk/test/clang-tidy/readability-simd-intrinsics-ppc.cpp clang-tools-extra/trunk/test/clang-tidy/readability-simd-intrinsics-x86.cpp Modified: clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst Modified: clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt?rev=325272&r1=325271&r2=325272&view=diff == --- clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt Thu Feb 15 09:56:43 2018 @@ -24,6 +24,7 @@ add_clang_library(clangTidyReadabilityMo RedundantStringCStrCheck.cpp RedundantSmartptrGetCheck.cpp RedundantStringInitCheck.cpp + SIMDIntrinsicsCheck.cpp SimplifyBooleanExprCheck.cpp StaticAccessedThroughInstanceCheck.cpp StaticDefinitionInAnonymousNamespaceCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp?rev=325272&r1=325271&r2=325272&view=diff == --- clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp Thu Feb 15 09:56:43 2018 @@ -31,6 +31,7 @@ #include "RedundantSmartptrGetCheck.h" #include "RedundantStringCStrCheck.h" #include "RedundantStringInitCheck.h" +#include "SIMDIntrinsicsCheck.h" #include "SimplifyBooleanExprCheck.h" #include "StaticAccessedThroughInstanceCheck.h" #include "StaticDefinitionInAnonymousNamespaceCheck.h" @@ -92,6 +93,8 @@ public: "readability-redundant-string-cstr"); CheckFactories.registerCheck( "readability-redundant-string-init"); +CheckFactories.registerCheck( +"readability-simd-intrinsics"); CheckFactories.registerCheck( "readability-simplify-boolean-expr"); CheckFactories.registerCheck( Added: clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.cpp?rev=325272&view=auto == --- clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.cpp (added) +++ clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.cpp Thu Feb 15 09:56:43 2018 @@ -0,0 +1,152 @@ +//===--- SIMDIntrinsicsCheck.cpp - clang-tidy--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "SIMDIntrinsicsCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/Triple.h" +#include "llvm/Support/Regex.h" + +using namespace clang::ast_matchers; + +namespace clang { +namespace tidy { +namespace readability { + +namespace { + +// If the callee has parameter of VectorType or pointer to VectorType, +// or the return type is VectorType, we consider it a vector function +// and a candidate for checking. +AST_MATCHER(FunctionDecl, isVectorFunction) { + bool IsVector = Node.getReturnTyp
r322017 - [index] Return when DC is null in handleReference
Author: maskray Date: Mon Jan 8 10:57:38 2018 New Revision: 322017 URL: http://llvm.org/viewvc/llvm-project?rev=322017&view=rev Log: [index] Return when DC is null in handleReference Summary: DC may sometimes be NULL and getContainerInfo(DC, Container) will dereference a null pointer. Default template arguments (the following example and many test files in https://github.com/nlohmann/json) may cause null pointer dereference. ```c++ template struct actor; template class Actor = actor> struct terminal; ``` In tools/libclang/CXIndexDataConsumer.cpp#L203 handleReference(ND, Loc, Cursor, dyn_cast_or_null(ASTNode.Parent), ASTNode.ContainerDC, ASTNode.OrigE, Kind); `dyn_cast_or_null(ASTNode.Parent)` is somehow a null pointer and in tools/libclang/CXIndexDataConsumer.cpp:935 ContainerInfo Container; getContainerInfo(DC, Container); The null DC is casted `ContInfo.cursor = getCursor(cast(DC));` and SIGSEGV. ``` See discussions in https://github.com/jacobdufault/cquery/issues/219 https://github.com/jacobdufault/cquery/issues/192 Reviewers: akyrtzi, sammccall, yvvan Reviewed By: sammccall Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D41575 Modified: cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp Modified: cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp?rev=322017&r1=322016&r2=322017&view=diff == --- cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp (original) +++ cfe/trunk/tools/libclang/CXIndexDataConsumer.cpp Mon Jan 8 10:57:38 2018 @@ -890,7 +890,7 @@ bool CXIndexDataConsumer::handleReferenc const DeclContext *DC, const Expr *E, CXIdxEntityRefKind Kind) { - if (!D) + if (!D || !DC) return false; CXCursor Cursor = E ? MakeCXCursor(E, cast(DC), CXTU) @@ -907,7 +907,7 @@ bool CXIndexDataConsumer::handleReferenc if (!CB.indexEntityReference) return false; - if (!D) + if (!D || !DC) return false; if (Loc.isInvalid()) return false; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r326909 - [clang-tidy] Add "portability" module and rename readability-simd-intrinsics to portability-simd-intrinsics
Author: maskray Date: Wed Mar 7 08:57:42 2018 New Revision: 326909 URL: http://llvm.org/viewvc/llvm-project?rev=326909&view=rev Log: [clang-tidy] Add "portability" module and rename readability-simd-intrinsics to portability-simd-intrinsics Reviewers: alexfh Subscribers: klimek, nemanjai, mgorny, xazax.hun, kbarton, cfe-commits Differential Revision: https://reviews.llvm.org/D44173 Added: clang-tools-extra/trunk/clang-tidy/portability/ clang-tools-extra/trunk/clang-tidy/portability/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/portability/PortabilityTidyModule.cpp clang-tools-extra/trunk/clang-tidy/portability/SIMDIntrinsicsCheck.cpp - copied, changed from r326809, clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.cpp clang-tools-extra/trunk/clang-tidy/portability/SIMDIntrinsicsCheck.h - copied, changed from r326809, clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/portability-simd-intrinsics.rst - copied, changed from r326809, clang-tools-extra/trunk/docs/clang-tidy/checks/readability-simd-intrinsics.rst clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-ppc.cpp - copied, changed from r326809, clang-tools-extra/trunk/test/clang-tidy/readability-simd-intrinsics-ppc.cpp clang-tools-extra/trunk/test/clang-tidy/portability-simd-intrinsics-x86.cpp - copied, changed from r326809, clang-tools-extra/trunk/test/clang-tidy/readability-simd-intrinsics-x86.cpp Removed: clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/SIMDIntrinsicsCheck.h clang-tools-extra/trunk/docs/clang-tidy/checks/readability-simd-intrinsics.rst clang-tools-extra/trunk/test/clang-tidy/readability-simd-intrinsics-ppc.cpp clang-tools-extra/trunk/test/clang-tidy/readability-simd-intrinsics-x86.cpp Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp clang-tools-extra/trunk/clang-tidy/readability/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/readability/ReadabilityTidyModule.cpp clang-tools-extra/trunk/clang-tidy/tool/CMakeLists.txt clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/clang-tidy/index.rst Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=326909&r1=326908&r2=326909&view=diff == --- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Wed Mar 7 08:57:42 2018 @@ -41,6 +41,7 @@ add_subdirectory(mpi) add_subdirectory(objc) add_subdirectory(performance) add_subdirectory(plugin) +add_subdirectory(portability) add_subdirectory(readability) add_subdirectory(tool) add_subdirectory(utils) Modified: clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt?rev=326909&r1=326908&r2=326909&view=diff == --- clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/plugin/CMakeLists.txt Wed Mar 7 08:57:42 2018 @@ -19,6 +19,7 @@ add_clang_library(clangTidyPlugin clangTidyMPIModule clangTidyObjCModule clangTidyPerformanceModule + clangTidyPortabilityModule clangTidyReadabilityModule clangTooling ) Modified: clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp?rev=326909&r1=326908&r2=326909&view=diff == --- clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/plugin/ClangTidyPlugin.cpp Wed Mar 7 08:57:42 2018 @@ -118,6 +118,11 @@ extern volatile int PerformanceModuleAnc static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination = PerformanceModuleAnchorSource; +// This anchor is used to force the linker to link the PortabilityModule. +extern volatile int PortabilityModuleAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED PortabilityModuleAnchorDestination = +PortabilityModuleAnchorSource; + // This anchor is used to force the linker to link the ReadabilityModule. extern volatile int ReadabilityModuleAnchorSource; static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination = Added: clang-tools-extra/trunk/clang-tidy/portability/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/c
[clang-tools-extra] r327885 - [clang-move] Fix move-used-helper-decls.cpp test.
Author: maskray Date: Mon Mar 19 12:05:53 2018 New Revision: 327885 URL: http://llvm.org/viewvc/llvm-project?rev=327885&view=rev Log: [clang-move] Fix move-used-helper-decls.cpp test. Modified: clang-tools-extra/trunk/test/clang-move/move-used-helper-decls.cpp Modified: clang-tools-extra/trunk/test/clang-move/move-used-helper-decls.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-move/move-used-helper-decls.cpp?rev=327885&r1=327884&r2=327885&view=diff == --- clang-tools-extra/trunk/test/clang-move/move-used-helper-decls.cpp (original) +++ clang-tools-extra/trunk/test/clang-move/move-used-helper-decls.cpp Mon Mar 19 12:05:53 2018 @@ -335,7 +335,6 @@ // CHECK-NEW-H-NEXT: void Fun1(); // CHECK-NEW-H-SAME: {{[[:space:]]}} // CHECK-NEW-H-NEXT: inline void Fun2() {} -// CHECK-NEW-H-SAME: {{[[:space:]]}} // CHECK-NEW-H-NEXT: } // namespace a ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r333836 - clang-interpreter: Add missing LLVM component Object
Author: maskray Date: Sun Jun 3 01:12:15 2018 New Revision: 333836 URL: http://llvm.org/viewvc/llvm-project?rev=333836&view=rev Log: clang-interpreter: Add missing LLVM component Object Modified: cfe/trunk/examples/clang-interpreter/CMakeLists.txt Modified: cfe/trunk/examples/clang-interpreter/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/CMakeLists.txt?rev=333836&r1=333835&r2=333836&view=diff == --- cfe/trunk/examples/clang-interpreter/CMakeLists.txt (original) +++ cfe/trunk/examples/clang-interpreter/CMakeLists.txt Sun Jun 3 01:12:15 2018 @@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS ExecutionEngine MC MCJIT + Object OrcJit Option RuntimeDyld ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r334539 - Work around false -Wmissing-braces warning from old clang which has been fixed in r314838
Author: maskray Date: Tue Jun 12 13:44:11 2018 New Revision: 334539 URL: http://llvm.org/viewvc/llvm-project?rev=334539&view=rev Log: Work around false -Wmissing-braces warning from old clang which has been fixed in r314838 Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp?rev=334539&r1=334538&r2=334539&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp Tue Jun 12 13:44:11 2018 @@ -883,7 +883,7 @@ UbigraphViz::~UbigraphViz() { std::string Ubiviz; if (auto Path = llvm::sys::findProgramByName("ubiviz")) Ubiviz = *Path; - std::array Args = {Ubiviz, Filename}; + std::array Args{{Ubiviz, Filename}}; if (llvm::sys::ExecuteAndWait(Ubiviz, Args, llvm::None, {}, 0, 0, &ErrMsg)) { llvm::errs() << "Error viewing graph: " << ErrMsg << "\n"; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r334870 - [docs] -fsanitize=cfi only allowed with -fvisibility=
Author: maskray Date: Fri Jun 15 16:11:18 2018 New Revision: 334870 URL: http://llvm.org/viewvc/llvm-project?rev=334870&view=rev Log: [docs] -fsanitize=cfi only allowed with -fvisibility= Modified: cfe/trunk/docs/SanitizerStats.rst Modified: cfe/trunk/docs/SanitizerStats.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SanitizerStats.rst?rev=334870&r1=334869&r2=334870&view=diff == --- cfe/trunk/docs/SanitizerStats.rst (original) +++ cfe/trunk/docs/SanitizerStats.rst Fri Jun 15 16:11:18 2018 @@ -56,7 +56,7 @@ Example: 10 A a; 11 g(&a); 12 } -$ clang++ -fsanitize=cfi -flto -fuse-ld=gold vcall.cc -fsanitize-stats -g +$ clang++ -fsanitize=cfi -fvisibility=hidden -flto -fuse-ld=gold vcall.cc -fsanitize-stats -g $ SANITIZER_STATS_PATH=a.stats ./a.out $ sanstats a.stats vcall.cc:6 _Z1gP1A cfi-vcall 1 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344098 - [Driver][cc1][cc1as] Call OptTable::PrintHelp with explicit " [options] file..."
Author: maskray Date: Tue Oct 9 17:15:33 2018 New Revision: 344098 URL: http://llvm.org/viewvc/llvm-project?rev=344098&view=rev Log: [Driver][cc1][cc1as] Call OptTable::PrintHelp with explicit " [options] file..." Summary: This is to accommodate a change in llvm/lib/Option/OptTable.cpp D51009 Reviewers: rupprecht, alexshap, jhenderson Reviewed By: rupprecht Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51109 Modified: cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp cfe/trunk/tools/driver/cc1as_main.cpp Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=344098&r1=344097&r2=344098&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct 9 17:15:33 2018 @@ -68,6 +68,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Path.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" @@ -1433,7 +1434,8 @@ void Driver::PrintHelp(bool ShowHidden) if (!ShowHidden) ExcludedFlagsBitmask |= HelpHidden; - getOpts().PrintHelp(llvm::outs(), Name.c_str(), DriverTitle.c_str(), + std::string Usage = llvm::formatv("{0} [options] file...", Name).str(); + getOpts().PrintHelp(llvm::outs(), Usage.c_str(), DriverTitle.c_str(), IncludedFlagsBitmask, ExcludedFlagsBitmask, /*ShowAllAliases=*/false); } Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=344098&r1=344097&r2=344098&view=diff == --- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original) +++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Tue Oct 9 17:15:33 2018 @@ -183,7 +183,7 @@ bool ExecuteCompilerInvocation(CompilerI // Honor -help. if (Clang->getFrontendOpts().ShowHelp) { std::unique_ptr Opts = driver::createDriverOptTable(); -Opts->PrintHelp(llvm::outs(), "clang -cc1", +Opts->PrintHelp(llvm::outs(), "clang -cc1 [options] file...", "LLVM 'Clang' Compiler: http://clang.llvm.org";, /*Include=*/driver::options::CC1Option, /*Exclude=*/0, /*ShowAllAliases=*/false); Modified: cfe/trunk/tools/driver/cc1as_main.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=344098&r1=344097&r2=344098&view=diff == --- cfe/trunk/tools/driver/cc1as_main.cpp (original) +++ cfe/trunk/tools/driver/cc1as_main.cpp Tue Oct 9 17:15:33 2018 @@ -534,7 +534,8 @@ int cc1as_main(ArrayRef Ar if (Asm.ShowHelp) { std::unique_ptr Opts(driver::createDriverOptTable()); -Opts->PrintHelp(llvm::outs(), "clang -cc1as", "Clang Integrated Assembler", +Opts->PrintHelp(llvm::outs(), "clang -cc1as [options] file...", +"Clang Integrated Assembler", /*Include=*/driver::options::CC1AsOption, /*Exclude=*/0, /*ShowAllAliases=*/false); return 0; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r344256 - [clang-move] Remove clang:: qualifier
Author: maskray Date: Thu Oct 11 09:09:26 2018 New Revision: 344256 URL: http://llvm.org/viewvc/llvm-project?rev=344256&view=rev Log: [clang-move] Remove clang:: qualifier Summary: The use sites are enclosed by `namespace clang`, so clang:: is not necessary. Many unqualified names have already been used, e.g. SourceManager SourceLocation LangOptions. This change makes the code terser and more consistent. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D53060 Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=344256&r1=344255&r2=344256&view=diff == --- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original) +++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Thu Oct 11 09:09:26 2018 @@ -128,18 +128,17 @@ AST_POLYMORPHIC_MATCHER_P(isExpansionInF AbsoluteFilePath; } -class FindAllIncludes : public clang::PPCallbacks { +class FindAllIncludes : public PPCallbacks { public: explicit FindAllIncludes(SourceManager *SM, ClangMoveTool *const MoveTool) : SM(*SM), MoveTool(MoveTool) {} - void InclusionDirective(clang::SourceLocation HashLoc, - const clang::Token & /*IncludeTok*/, + void InclusionDirective(SourceLocation HashLoc, const Token & /*IncludeTok*/, StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, - const clang::FileEntry * /*File*/, - StringRef SearchPath, StringRef /*RelativePath*/, - const clang::Module * /*Imported*/, + CharSourceRange FilenameRange, + const FileEntry * /*File*/, StringRef SearchPath, + StringRef /*RelativePath*/, + const Module * /*Imported*/, SrcMgr::CharacteristicKind /*FileType*/) override { if (const auto *FileEntry = SM.getFileEntryForID(SM.getFileID(HashLoc))) MoveTool->addIncludes(FileName, IsAngled, SearchPath, @@ -165,9 +164,9 @@ public: : MoveTool(MoveTool) {} void run(const MatchFinder::MatchResult &Result) override { -const auto *FD = Result.Nodes.getNodeAs("function"); +const auto *FD = Result.Nodes.getNodeAs("function"); assert(FD); -const clang::NamedDecl *D = FD; +const NamedDecl *D = FD; if (const auto *FTD = FD->getDescribedFunctionTemplate()) D = FTD; MoveDeclFromOldFileToNewFile(MoveTool, D); @@ -183,7 +182,7 @@ public: : MoveTool(MoveTool) {} void run(const MatchFinder::MatchResult &Result) override { -const auto *VD = Result.Nodes.getNodeAs("var"); +const auto *VD = Result.Nodes.getNodeAs("var"); assert(VD); MoveDeclFromOldFileToNewFile(MoveTool, VD); } @@ -198,10 +197,10 @@ public: : MoveTool(MoveTool) {} void run(const MatchFinder::MatchResult &Result) override { -if (const auto *TD = Result.Nodes.getNodeAs("typedef")) +if (const auto *TD = Result.Nodes.getNodeAs("typedef")) MoveDeclFromOldFileToNewFile(MoveTool, TD); else if (const auto *TAD = - Result.Nodes.getNodeAs("type_alias")) { + Result.Nodes.getNodeAs("type_alias")) { const NamedDecl * D = TAD; if (const auto * TD = TAD->getDescribedAliasTemplate()) D = TD; @@ -219,7 +218,7 @@ public: : MoveTool(MoveTool) {} void run(const MatchFinder::MatchResult &Result) override { -const auto *ED = Result.Nodes.getNodeAs("enum"); +const auto *ED = Result.Nodes.getNodeAs("enum"); assert(ED); MoveDeclFromOldFileToNewFile(MoveTool, ED); } @@ -233,21 +232,19 @@ public: explicit ClassDeclarationMatch(ClangMoveTool *MoveTool) : MoveTool(MoveTool) {} void run(const MatchFinder::MatchResult &Result) override { -clang::SourceManager* SM = &Result.Context->getSourceManager(); -if (const auto *CMD = -Result.Nodes.getNodeAs("class_method")) +SourceManager *SM = &Result.Context->getSourceManager(); +if (const auto *CMD = Result.Nodes.getNodeAs("class_method")) MatchClassMethod(CMD, SM); -else if (const auto *VD = Result.Nodes.getNodeAs( - "class_static_var_decl")) +else if (const auto *VD = + Result.Nodes.getNodeAs("class_static_var_decl")) MatchClassStaticVariable(VD, SM); -else if (const auto *CD = Result.Nodes.getNodeAs( - "moved_class")) +else if (const auto *CD = + Result.Nodes.getNodeAs("moved_class")) MatchClassDeclaration(CD, SM); } private: - void MatchClassMethod(const clang::CXXMethodDecl* CMD, -
r344859 - Use llvm::{all, any, none}_of instead std::{all, any, none}_of. NFC
Author: maskray Date: Sat Oct 20 10:53:42 2018 New Revision: 344859 URL: http://llvm.org/viewvc/llvm-project?rev=344859&view=rev Log: Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC Modified: cfe/trunk/lib/AST/VTableBuilder.cpp cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp cfe/trunk/lib/Analysis/CloneDetection.cpp cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/Parse/ParseTentative.cpp cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/lib/Sema/SemaLookup.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Modified: cfe/trunk/lib/AST/VTableBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=344859&r1=344858&r2=344859&view=diff == --- cfe/trunk/lib/AST/VTableBuilder.cpp (original) +++ cfe/trunk/lib/AST/VTableBuilder.cpp Sat Oct 20 10:53:42 2018 @@ -3406,10 +3406,9 @@ static void removeRedundantPaths(std::li for (const FullPathTy &OtherPath : FullPaths) { if (&SpecificPath == &OtherPath) continue; - if (std::all_of(SpecificPath.begin(), SpecificPath.end(), - [&](const BaseSubobject &BSO) { -return OtherPath.count(BSO) != 0; - })) { + if (llvm::all_of(SpecificPath, [&](const BaseSubobject &BSO) { +return OtherPath.count(BSO) != 0; + })) { return true; } } @@ -3485,10 +3484,9 @@ static const FullPathTy *selectBestPath( // It's possible that the overrider isn't in this path. If so, skip it // because this path didn't introduce it. const CXXRecordDecl *OverridingParent = OverridingMethod->getParent(); - if (std::none_of(SpecificPath.begin(), SpecificPath.end(), - [&](const BaseSubobject &BSO) { - return BSO.getBase() == OverridingParent; - })) + if (llvm::none_of(SpecificPath, [&](const BaseSubobject &BSO) { +return BSO.getBase() == OverridingParent; + })) continue; CurrentOverrides.insert(OverridingMethod); } Modified: cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp?rev=344859&r1=344858&r2=344859&view=diff == --- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp (original) +++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp Sat Oct 20 10:53:42 2018 @@ -144,10 +144,10 @@ DynTypedMatcher DynTypedMatcher::constru ast_type_traits::ASTNodeKind SupportedKind, std::vector InnerMatchers) { assert(!InnerMatchers.empty() && "Array must not be empty."); - assert(std::all_of(InnerMatchers.begin(), InnerMatchers.end(), - [SupportedKind](const DynTypedMatcher &M) { - return M.canConvertTo(SupportedKind); - }) && + assert(llvm::all_of(InnerMatchers, + [SupportedKind](const DynTypedMatcher &M) { +return M.canConvertTo(SupportedKind); + }) && "InnerMatchers must be convertible to SupportedKind!"); // We must relax the restrict kind here. @@ -449,7 +449,7 @@ bool HasNameMatcher::matchesNodeUnqualif assert(UseUnqualifiedMatch); llvm::SmallString<128> Scratch; StringRef NodeName = getNodeName(Node, Scratch); - return std::any_of(Names.begin(), Names.end(), [&](StringRef Name) { + return llvm::any_of(Names, [&](StringRef Name) { return consumeNameSuffix(Name, NodeName) && Name.empty(); }); } Modified: cfe/trunk/lib/Analysis/CloneDetection.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CloneDetection.cpp?rev=344859&r1=344858&r2=344859&view=diff == --- cfe/trunk/lib/Analysis/CloneDetection.cpp (original) +++ cfe/trunk/lib/Analysis/CloneDetection.cpp Sat Oct 20 10:53:42 2018 @@ -523,8 +523,7 @@ void CloneConstraint::splitCloneGroups( Result.push_back(PotentialGroup); } -assert(std::all_of(Indexes.begin(), Indexes.end(), - [](char c) { return c == 1; })); +assert(llvm::all_of(Indexes, [](char c) { return c == 1; })); } CloneGroups = Result; } Modified: cfe/trunk/lib/CodeGen/CGCall.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=344859&r1=344858&r2=344859&view=diff == --- cfe/trunk/lib/CodeGen/CGCall.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCall.cpp Sat Oct 20 10:53:42 2018 @@ -741,8 +741,8 @@ CodeGenTypes::arrangeLLVMFunctionInfo(Ca FunctionType::ExtInfo info,
[clang-tools-extra] r351306 - [clangd] Fix XPC after rCTE351280
Author: maskray Date: Wed Jan 16 00:13:15 2019 New Revision: 351306 URL: http://llvm.org/viewvc/llvm-project?rev=351306&view=rev Log: [clangd] Fix XPC after rCTE351280 Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=351306&r1=351305&r2=351306&view=diff == --- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original) +++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Wed Jan 16 00:13:15 2019 @@ -417,11 +417,11 @@ int main(int argc, char *argv[]) { std::unique_ptr TransportLayer; if (getenv("CLANGD_AS_XPC_SERVICE")) { -#ifdef CLANGD_BUILD_XPC +#if CLANGD_BUILD_XPC TransportLayer = newXPCTransport(); #else -errs() << "This clangd binary wasn't built with XPC support.\n"; -return ErrorResultCode::CantRunAsXPCService; +llvm::errs() << "This clangd binary wasn't built with XPC support.\n"; +return (int)ErrorResultCode::CantRunAsXPCService; #endif } else { TransportLayer = newJSONTransport( ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345950 - Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds
Author: maskray Date: Thu Nov 1 21:09:08 2018 New Revision: 345950 URL: http://llvm.org/viewvc/llvm-project?rev=345950&view=rev Log: Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds Modified: cfe/trunk/lib/StaticAnalyzer/Core/BasicValueFactory.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Core/BasicValueFactory.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BasicValueFactory.cpp?rev=345950&r1=345949&r2=345950&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Core/BasicValueFactory.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Core/BasicValueFactory.cpp Thu Nov 1 21:09:08 2018 @@ -207,7 +207,7 @@ BasicValueFactory::evalAPSInt(BinaryOper const llvm::APSInt& V1, const llvm::APSInt& V2) { switch (Op) { default: - assert(false && "Invalid Opcode."); + llvm_unreachable("Invalid Opcode."); case BO_Mul: return &getValue( V1 * V2 ); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r345951 - Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds
Author: maskray Date: Thu Nov 1 21:17:17 2018 New Revision: 345951 URL: http://llvm.org/viewvc/llvm-project?rev=345951&view=rev Log: Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds Modified: clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp?rev=345951&r1=345950&r2=345951&view=diff == --- clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp Thu Nov 1 21:17:17 2018 @@ -134,7 +134,7 @@ ConversionKind ClassifyFormatString(Stri StringRef ClassifyConversionType(ConversionKind K) { switch (K) { case ConversionKind::None: -assert(false && "Unexpected conversion kind"); +llvm_unreachable("Unexpected conversion kind"); case ConversionKind::ToInt: case ConversionKind::ToLongInt: case ConversionKind::ToIntMax: @@ -154,7 +154,7 @@ StringRef ClassifyConversionType(Convers StringRef ClassifyReplacement(ConversionKind K) { switch (K) { case ConversionKind::None: -assert(false && "Unexpected conversion kind"); +llvm_unreachable("Unexpected conversion kind"); case ConversionKind::ToInt: return "strtol"; case ConversionKind::ToUInt: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r345952 - [clangd] Fix clang -Wimplicit-fallthrough
Author: maskray Date: Thu Nov 1 21:23:50 2018 New Revision: 345952 URL: http://llvm.org/viewvc/llvm-project?rev=345952&view=rev Log: [clangd] Fix clang -Wimplicit-fallthrough Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=345952&r1=345951&r2=345952&view=diff == --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Thu Nov 1 21:23:50 2018 @@ -219,7 +219,7 @@ struct CompletionCandidate { case index::SymbolKind::InstanceMethod: case index::SymbolKind::StaticMethod: assert(false && "Don't expect members from index in code completion"); -// fall through +LLVM_FALLTHROUGH; case index::SymbolKind::Function: // We can't group overloads together that need different #includes. // This could break #include insertion. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r345953 - [clangd] Really fix clang -Wimplicit-fallthrough
Author: maskray Date: Thu Nov 1 22:59:29 2018 New Revision: 345953 URL: http://llvm.org/viewvc/llvm-project?rev=345953&view=rev Log: [clangd] Really fix clang -Wimplicit-fallthrough The intention was to fall through to Function case in LLVM_ENABLE_ASSERTIONS=Off builds. Use #ifndef NDEBUG to fix -Wimplicit-fallthrough Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=345953&r1=345952&r2=345953&view=diff == --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Thu Nov 1 22:59:29 2018 @@ -218,8 +218,11 @@ struct CompletionCandidate { case index::SymbolKind::ClassMethod: case index::SymbolKind::InstanceMethod: case index::SymbolKind::StaticMethod: -assert(false && "Don't expect members from index in code completion"); +#ifndef NDEBUG +llvm_unreachable("Don't expect members from index in code completion"); +#else LLVM_FALLTHROUGH; +#endif case index::SymbolKind::Function: // We can't group overloads together that need different #includes. // This could break #include insertion. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345992 - [analyzer] Fix diagnostics/explicit-suppression.cpp
Author: maskray Date: Fri Nov 2 09:23:37 2018 New Revision: 345992 URL: http://llvm.org/viewvc/llvm-project?rev=345992&view=rev Log: [analyzer] Fix diagnostics/explicit-suppression.cpp *OI++ = *II++ is on line 670, not 668 Modified: cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp Modified: cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp?rev=345992&r1=345991&r2=345992&view=diff == --- cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp (original) +++ cfe/trunk/test/Analysis/diagnostics/explicit-suppression.cpp Fri Nov 2 09:23:37 2018 @@ -19,6 +19,6 @@ class C { void testCopyNull(C *I, C *E) { std::copy(I, E, (C *)0); #ifndef SUPPRESSED - // expected-warning@../Inputs/system-header-simulator-cxx.h:668 {{Called C++ object pointer is null}} + // expected-warning@../Inputs/system-header-simulator-cxx.h:670 {{Called C++ object pointer is null}} #endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r347293 - [libclang] Unify getCursorDecl and getCursorParentDecl
Author: maskray Date: Tue Nov 20 00:00:00 2018 New Revision: 347293 URL: http://llvm.org/viewvc/llvm-project?rev=347293&view=rev Log: [libclang] Unify getCursorDecl and getCursorParentDecl They do the same thing, thus the latter (which has only 2 call sites) can be deleted. Modified: cfe/trunk/tools/libclang/CIndex.cpp cfe/trunk/tools/libclang/CXCursor.cpp cfe/trunk/tools/libclang/CXCursor.h Modified: cfe/trunk/tools/libclang/CIndex.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=347293&r1=347292&r2=347293&view=diff == --- cfe/trunk/tools/libclang/CIndex.cpp (original) +++ cfe/trunk/tools/libclang/CIndex.cpp Tue Nov 20 00:00:00 2018 @@ -6940,7 +6940,7 @@ AnnotateTokensWorker::DetermineChildActi if (const ImplicitCastExpr *ICE = dyn_cast(Callee)) { const Expr *SubExpr = ICE->getSubExpr(); if (const DeclRefExpr *DRE = dyn_cast(SubExpr)) { -const Decl *parentDecl = getCursorParentDecl(Cursor); +const Decl *parentDecl = getCursorDecl(Cursor); CXTranslationUnit TU = clang_Cursor_getTranslationUnit(Cursor); // Visit the DeclRefExpr as last. @@ -7163,7 +7163,7 @@ AnnotateTokensWorker::Visit(CXCursor cur // MyCXXClass foo; // Make sure we don't annotate 'foo' as a CallExpr cursor. if (clang_isExpression(cursorK) && MoreTokens()) { const Expr *E = getCursorExpr(cursor); -if (const Decl *D = getCursorParentDecl(cursor)) { +if (const Decl *D = getCursorDecl(cursor)) { const unsigned I = NextToken(); if (E->getBeginLoc().isValid() && D->getLocation().isValid() && E->getBeginLoc() == D->getLocation() && Modified: cfe/trunk/tools/libclang/CXCursor.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=347293&r1=347292&r2=347293&view=diff == --- cfe/trunk/tools/libclang/CXCursor.cpp (original) +++ cfe/trunk/tools/libclang/CXCursor.cpp Tue Nov 20 00:00:00 2018 @@ -1012,10 +1012,6 @@ const Attr *cxcursor::getCursorAttr(CXCu return static_cast(Cursor.data[1]); } -const Decl *cxcursor::getCursorParentDecl(CXCursor Cursor) { - return static_cast(Cursor.data[0]); -} - ASTContext &cxcursor::getCursorContext(CXCursor Cursor) { return getCursorASTUnit(Cursor)->getASTContext(); } Modified: cfe/trunk/tools/libclang/CXCursor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.h?rev=347293&r1=347292&r2=347293&view=diff == --- cfe/trunk/tools/libclang/CXCursor.h (original) +++ cfe/trunk/tools/libclang/CXCursor.h Tue Nov 20 00:00:00 2018 @@ -43,11 +43,11 @@ class TemplateName; class TypeDecl; class VarDecl; class IdentifierInfo; - + namespace cxcursor { CXCursor getCursor(CXTranslationUnit, SourceLocation); - + CXCursor MakeCXCursor(const clang::Attr *A, const clang::Decl *Parent, CXTranslationUnit TU); CXCursor MakeCXCursor(const clang::Decl *D, CXTranslationUnit TU, @@ -125,7 +125,7 @@ std::pair getCursorMemberRef(CXCursor C); @@ -232,17 +232,16 @@ CXCursor MakeCursorOverloadedDeclRef(Tem typedef llvm::PointerUnion3 OverloadedDeclRefStorage; - + /// Unpack an overloaded declaration reference into an expression, /// declaration, or template name along with the source location. std::pair getCursorOverloadedDeclRef(CXCursor C); - + const Decl *getCursorDecl(CXCursor Cursor); const Expr *getCursorExpr(CXCursor Cursor); const Stmt *getCursorStmt(CXCursor Cursor); const Attr *getCursorAttr(CXCursor Cursor); -const Decl *getCursorParentDecl(CXCursor Cursor); ASTContext &getCursorContext(CXCursor Cursor); ASTUnit *getCursorASTUnit(CXCursor Cursor); @@ -250,14 +249,14 @@ CXTranslationUnit getCursorTU(CXCursor C void getOverriddenCursors(CXCursor cursor, SmallVectorImpl &overridden); - + /// Create an opaque pool used for fast generation of overridden /// CXCursor arrays. void *createOverridenCXCursorsPool(); /// Dispose of the overridden CXCursors pool. void disposeOverridenCXCursorsPool(void *pool); - + /// Returns a index/location pair for a selector identifier if the cursor /// points to one. std::pair getSelectorIdentifierIndexAndLoc(CXCursor); @@ -285,7 +284,7 @@ CXCursor getTypeRefCursor(CXCursor curso bool getDeclCursorUSR(const Decl *D, SmallVectorImpl &Buf); bool operator==(CXCursor X, CXCursor Y); - + inline bool operator!=(CXCursor X, CXCursor Y) { return !(X == Y); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r347508 - [CodeComplete] Delete unused variable in rC342449
Author: maskray Date: Fri Nov 23 16:41:13 2018 New Revision: 347508 URL: http://llvm.org/viewvc/llvm-project?rev=347508&view=rev Log: [CodeComplete] Delete unused variable in rC342449 Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=347508&r1=347507&r2=347508&view=diff == --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original) +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Nov 23 16:41:13 2018 @@ -8214,7 +8214,6 @@ void Sema::CodeCompleteIncludedFile(llvm // Helper: adds results relative to IncludeDir, if possible. auto AddFilesFromDirLookup = [&](const DirectoryLookup &IncludeDir, bool IsSystem) { -llvm::SmallString<128> Dir; switch (IncludeDir.getLookupType()) { case DirectoryLookup::LT_HeaderMap: // header maps are not (currently) enumerable. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r347529 - [CodeComplete] Simplify CodeCompleteConsumer.cpp, NFC
Author: maskray Date: Sun Nov 25 12:57:05 2018 New Revision: 347529 URL: http://llvm.org/viewvc/llvm-project?rev=347529&view=rev Log: [CodeComplete] Simplify CodeCompleteConsumer.cpp, NFC Use range-based for loops Use XStr.compare(YStr) < 0 Format misaligned code Modified: cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp Modified: cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=347529&r1=347528&r2=347529&view=diff == --- cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp (original) +++ cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp Sun Nov 25 12:57:05 2018 @@ -272,23 +272,18 @@ CodeCompletionString::Chunk::CreateResul return Chunk(CK_ResultType, ResultType); } -CodeCompletionString::Chunk -CodeCompletionString::Chunk::CreateCurrentParameter( -const char *CurrentParameter) { +CodeCompletionString::Chunk CodeCompletionString::Chunk::CreateCurrentParameter( +const char *CurrentParameter) { return Chunk(CK_CurrentParameter, CurrentParameter); } -CodeCompletionString::CodeCompletionString(const Chunk *Chunks, - unsigned NumChunks, - unsigned Priority, - CXAvailabilityKind Availability, - const char **Annotations, - unsigned NumAnnotations, - StringRef ParentName, - const char *BriefComment) -: NumChunks(NumChunks), NumAnnotations(NumAnnotations), - Priority(Priority), Availability(Availability), - ParentName(ParentName), BriefComment(BriefComment) { +CodeCompletionString::CodeCompletionString( +const Chunk *Chunks, unsigned NumChunks, unsigned Priority, +CXAvailabilityKind Availability, const char **Annotations, +unsigned NumAnnotations, StringRef ParentName, const char *BriefComment) +: NumChunks(NumChunks), NumAnnotations(NumAnnotations), Priority(Priority), + Availability(Availability), ParentName(ParentName), + BriefComment(BriefComment) { assert(NumChunks <= 0x); assert(NumAnnotations <= 0x); @@ -296,7 +291,8 @@ CodeCompletionString::CodeCompletionStri for (unsigned I = 0; I != NumChunks; ++I) StoredChunks[I] = Chunks[I]; - const char **StoredAnnotations = reinterpret_cast(StoredChunks + NumChunks); + const char **StoredAnnotations = + reinterpret_cast(StoredChunks + NumChunks); for (unsigned I = 0; I != NumAnnotations; ++I) StoredAnnotations[I] = Annotations[I]; } @@ -307,7 +303,7 @@ unsigned CodeCompletionString::getAnnota const char *CodeCompletionString::getAnnotation(unsigned AnnotationNr) const { if (AnnotationNr < NumAnnotations) -return reinterpret_cast(end())[AnnotationNr]; +return reinterpret_cast(end())[AnnotationNr]; else return nullptr; } @@ -316,27 +312,33 @@ std::string CodeCompletionString::getAsS std::string Result; llvm::raw_string_ostream OS(Result); - for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) { -switch (C->Kind) { -case CK_Optional: OS << "{#" << C->Optional->getAsString() << "#}"; break; -case CK_Placeholder: OS << "<#" << C->Text << "#>"; break; - + for (const Chunk &C : *this) { +switch (C.Kind) { +case CK_Optional: + OS << "{#" << C.Optional->getAsString() << "#}"; + break; +case CK_Placeholder: + OS << "<#" << C.Text << "#>"; + break; case CK_Informative: case CK_ResultType: - OS << "[#" << C->Text << "#]"; + OS << "[#" << C.Text << "#]"; + break; +case CK_CurrentParameter: + OS << "<#" << C.Text << "#>"; + break; +default: + OS << C.Text; break; - -case CK_CurrentParameter: OS << "<#" << C->Text << "#>"; break; -default: OS << C->Text; break; } } return OS.str(); } const char *CodeCompletionString::getTypedText() const { - for (iterator C = begin(), CEnd = end(); C != CEnd; ++C) -if (C->Kind == CK_TypedText) - return C->Text; + for (const Chunk &C : *this) +if (C.Kind == CK_TypedText) + return C.Text; return nullptr; } @@ -371,7 +373,7 @@ StringRef CodeCompletionTUInfo::getParen // Find the interesting names. SmallVector Contexts; while (DC && !DC->isFunctionOrMethod()) { -if (const NamedDecl *ND = dyn_cast(DC)) { +if (const auto *ND = dyn_cast(DC)) { if (ND->getIdentifier()) Contexts.push_back(DC); } @@ -390,11 +392,11 @@ StringRef CodeCompletionTUInfo::getParen OS << "::"; } - const DeclContext *CurDC = Contexts[I-1]; - if (const ObjCCategoryImplDecl *CatImpl = dyn_cast(CurDC)) + const DeclContext *CurDC = Contexts[I - 1]; + i
r347895 - Simplify the __builtin_constant_p test that was used to catch rC347417 failure
Author: maskray Date: Thu Nov 29 10:26:39 2018 New Revision: 347895 URL: http://llvm.org/viewvc/llvm-project?rev=347895&view=rev Log: Simplify the __builtin_constant_p test that was used to catch rC347417 failure Reviewers: rsmith, void, shafik Reviewed By: void Subscribers: kristina, cfe-commits Differential Revision: https://reviews.llvm.org/D54964 Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp?rev=347895&r1=347894&r2=347895&view=diff == --- cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp (original) +++ cfe/trunk/test/SemaCXX/constant-expression-cxx1y.cpp Thu Nov 29 10:26:39 2018 @@ -1123,10 +1123,7 @@ static_assert(e2.x != e2.y, ""); } // namespace IndirectFields -constexpr bool __constant_string_p(const char *__s) { - while (__builtin_constant_p(*__s) && *__s) -__s++; +constexpr bool indirect_builtin_constant_p(const char *__s) { return __builtin_constant_p(*__s); } - -constexpr bool n = __constant_string_p("a"); +constexpr bool n = indirect_builtin_constant_p("a"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r348037 - [ExprConstant] Try fixing __builtin_constant_p after D54355 (rC347417)
Author: maskray Date: Fri Nov 30 13:15:41 2018 New Revision: 348037 URL: http://llvm.org/viewvc/llvm-project?rev=348037&view=rev Log: [ExprConstant] Try fixing __builtin_constant_p after D54355 (rC347417) Summary: Reinstate the original behavior (Success(false, E)) before D54355 when this branch is taken. This fixes spurious error of the following snippet: extern char extern_var; struct { int a; } a = {__builtin_constant_p(extern_var)}; Modified: cfe/trunk/lib/AST/ExprConstant.cpp Modified: cfe/trunk/lib/AST/ExprConstant.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=348037&r1=348036&r2=348037&view=diff == --- cfe/trunk/lib/AST/ExprConstant.cpp (original) +++ cfe/trunk/lib/AST/ExprConstant.cpp Fri Nov 30 13:15:41 2018 @@ -8199,7 +8199,6 @@ bool IntExprEvaluator::VisitBuiltinCallE // We can delay calculation of __builtin_constant_p until after // inlining. Note: This diagnostic won't be shown to the user. Info.FFDiag(E, diag::note_invalid_subexpr_in_const_expr); - return false; } return Success(false, E); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r348039 - Revert r347417 "Re-Reinstate 347294 with a fix for the failures."
Author: maskray Date: Fri Nov 30 13:26:09 2018 New Revision: 348039 URL: http://llvm.org/viewvc/llvm-project?rev=348039&view=rev Log: Revert r347417 "Re-Reinstate 347294 with a fix for the failures." Kept the "indirect_builtin_constant_p" test case in test/SemaCXX/constant-expression-cxx1y.cpp while we are investigating why the following snippet fails: extern char extern_var; struct { int a; } a = {__builtin_constant_p(extern_var)}; Removed: cfe/trunk/test/CodeGen/builtin-constant-p.c cfe/trunk/test/CodeGenCXX/builtin-constant-p.cpp Modified: cfe/trunk/include/clang/AST/Expr.h cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/lib/AST/Expr.cpp cfe/trunk/lib/AST/ExprConstant.cpp cfe/trunk/lib/Analysis/CFG.cpp cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGExprScalar.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/CodeGen/CGStmt.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp cfe/trunk/lib/Sema/SemaCast.cpp cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/lib/Sema/SemaStmtAsm.cpp cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp cfe/trunk/test/Analysis/builtin-functions.cpp cfe/trunk/test/Sema/builtins.c cfe/trunk/test/SemaCXX/compound-literal.cpp Modified: cfe/trunk/include/clang/AST/Expr.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=348039&r1=348038&r2=348039&view=diff == --- cfe/trunk/include/clang/AST/Expr.h (original) +++ cfe/trunk/include/clang/AST/Expr.h Fri Nov 30 13:26:09 2018 @@ -583,8 +583,7 @@ public: /// this function returns true, it returns the folded constant in Result. If /// the expression is a glvalue, an lvalue-to-rvalue conversion will be /// applied. - bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, -bool InConstantContext = false) const; + bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx) const; /// EvaluateAsBooleanCondition - Return true if this is a constant /// which we can fold and convert to a boolean condition using @@ -601,7 +600,7 @@ public: /// EvaluateAsInt - Return true if this is a constant which we can fold and /// convert to an integer, using any crazy technique that we want to. - bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, + bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects = SE_NoSideEffects) const; /// EvaluateAsFloat - Return true if this is a constant which we can fold and @@ -902,15 +901,10 @@ public: /// ConstantExpr - An expression that occurs in a constant context. class ConstantExpr : public FullExpr { +public: ConstantExpr(Expr *subexpr) : FullExpr(ConstantExprClass, subexpr) {} -public: - static ConstantExpr *Create(const ASTContext &Context, Expr *E) { -assert(!isa(E)); -return new (Context) ConstantExpr(E); - } - /// Build an empty constant expression wrapper. explicit ConstantExpr(EmptyShell Empty) : FullExpr(ConstantExprClass, Empty) {} @@ -3093,8 +3087,8 @@ inline Expr *Expr::IgnoreImpCasts() { while (true) if (ImplicitCastExpr *ice = dyn_cast(e)) e = ice->getSubExpr(); -else if (FullExpr *fe = dyn_cast(e)) - e = fe->getSubExpr(); +else if (ConstantExpr *ce = dyn_cast(e)) + e = ce->getSubExpr(); else break; return e; Modified: cfe/trunk/lib/AST/ASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=348039&r1=348038&r2=348039&view=diff == --- cfe/trunk/lib/AST/ASTImporter.cpp (original) +++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Nov 30 13:26:09 2018 @@ -6388,7 +6388,7 @@ ExpectedStmt ASTNodeImporter::VisitConst Expr *ToSubExpr; std::tie(ToSubExpr) = *Imp; - return ConstantExpr::Create(Importer.getToContext(), ToSubExpr); + return new (Importer.getToContext()) ConstantExpr(ToSubExpr); } ExpectedStmt AST
r348053 - Revert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures.""
Author: maskray Date: Fri Nov 30 15:41:18 2018 New Revision: 348053 URL: http://llvm.org/viewvc/llvm-project?rev=348053&view=rev Log: Revert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures."" It seems the two failing tests can be simply fixed after r348037 Fix 3 cases in Analysis/builtin-functions.cpp Delete the bad CodeGen/builtin-constant-p.c for now Added: cfe/trunk/test/CodeGenCXX/builtin-constant-p.cpp Modified: cfe/trunk/include/clang/AST/Expr.h cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/lib/AST/Expr.cpp cfe/trunk/lib/AST/ExprConstant.cpp cfe/trunk/lib/Analysis/CFG.cpp cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/CodeGen/CGDebugInfo.cpp cfe/trunk/lib/CodeGen/CGExprScalar.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/CodeGen/CGStmt.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.cpp cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp cfe/trunk/lib/Sema/SemaCast.cpp cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaInit.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/lib/Sema/SemaStmtAsm.cpp cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp cfe/trunk/test/Sema/builtins.c cfe/trunk/test/SemaCXX/compound-literal.cpp Modified: cfe/trunk/include/clang/AST/Expr.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=348053&r1=348052&r2=348053&view=diff == --- cfe/trunk/include/clang/AST/Expr.h (original) +++ cfe/trunk/include/clang/AST/Expr.h Fri Nov 30 15:41:18 2018 @@ -583,7 +583,8 @@ public: /// this function returns true, it returns the folded constant in Result. If /// the expression is a glvalue, an lvalue-to-rvalue conversion will be /// applied. - bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx) const; + bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, +bool InConstantContext = false) const; /// EvaluateAsBooleanCondition - Return true if this is a constant /// which we can fold and convert to a boolean condition using @@ -600,7 +601,7 @@ public: /// EvaluateAsInt - Return true if this is a constant which we can fold and /// convert to an integer, using any crazy technique that we want to. - bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx, + bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects = SE_NoSideEffects) const; /// EvaluateAsFloat - Return true if this is a constant which we can fold and @@ -901,10 +902,15 @@ public: /// ConstantExpr - An expression that occurs in a constant context. class ConstantExpr : public FullExpr { -public: ConstantExpr(Expr *subexpr) : FullExpr(ConstantExprClass, subexpr) {} +public: + static ConstantExpr *Create(const ASTContext &Context, Expr *E) { +assert(!isa(E)); +return new (Context) ConstantExpr(E); + } + /// Build an empty constant expression wrapper. explicit ConstantExpr(EmptyShell Empty) : FullExpr(ConstantExprClass, Empty) {} @@ -3087,8 +3093,8 @@ inline Expr *Expr::IgnoreImpCasts() { while (true) if (ImplicitCastExpr *ice = dyn_cast(e)) e = ice->getSubExpr(); -else if (ConstantExpr *ce = dyn_cast(e)) - e = ce->getSubExpr(); +else if (FullExpr *fe = dyn_cast(e)) + e = fe->getSubExpr(); else break; return e; Modified: cfe/trunk/lib/AST/ASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=348053&r1=348052&r2=348053&view=diff == --- cfe/trunk/lib/AST/ASTImporter.cpp (original) +++ cfe/trunk/lib/AST/ASTImporter.cpp Fri Nov 30 15:41:18 2018 @@ -6388,7 +6388,7 @@ ExpectedStmt ASTNodeImporter::VisitConst Expr *ToSubExpr; std::tie(ToSubExpr) = *Imp; - return new (Importer.getToContext()) ConstantExpr(ToSubExpr); + return ConstantExpr::Create(Importer.getToContext(), ToSubExpr); } ExpectedStmt ASTNodeImporter::VisitParenExpr(ParenExpr *E) { Modified: cfe/trunk/lib/AST/Expr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=348053&r1=3480
r348065 - [Basic] Move DiagnosticsEngine::dump from .h to .cpp
Author: maskray Date: Fri Nov 30 17:43:05 2018 New Revision: 348065 URL: http://llvm.org/viewvc/llvm-project?rev=348065&view=rev Log: [Basic] Move DiagnosticsEngine::dump from .h to .cpp The two LLVM_DUMP_METHOD methods have a undefined reference on clang::DiagnosticsEngine::DiagStateMap::dump. tools/clang/tools/extra/clangd/benchmarks/IndexBenchmark links in clangDaemon but does not link in clangBasic explicitly, which causes a linker error "undefined symbol" in !NDEBUG + -DBUILD_SHARED_LIBS=on builds. Move LLVM_DUMP_METHOD methods to .cpp to fix IndexBenchmark. They should be unconditionally defined as they are also used by non-dump-method #pragma clang __debug diag_mapping Modified: cfe/trunk/include/clang/Basic/Diagnostic.h cfe/trunk/lib/Basic/Diagnostic.cpp Modified: cfe/trunk/include/clang/Basic/Diagnostic.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=348065&r1=348064&r2=348065&view=diff == --- cfe/trunk/include/clang/Basic/Diagnostic.h (original) +++ cfe/trunk/include/clang/Basic/Diagnostic.h Fri Nov 30 17:43:05 2018 @@ -486,10 +486,8 @@ public: DiagnosticsEngine &operator=(const DiagnosticsEngine &) = delete; ~DiagnosticsEngine(); - LLVM_DUMP_METHOD void dump() const { DiagStatesByLoc.dump(*SourceMgr); } - LLVM_DUMP_METHOD void dump(StringRef DiagName) const { -DiagStatesByLoc.dump(*SourceMgr, DiagName); - } + LLVM_DUMP_METHOD void dump() const; + LLVM_DUMP_METHOD void dump(StringRef DiagName) const; const IntrusiveRefCntPtr &getDiagnosticIDs() const { return Diags; Modified: cfe/trunk/lib/Basic/Diagnostic.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=348065&r1=348064&r2=348065&view=diff == --- cfe/trunk/lib/Basic/Diagnostic.cpp (original) +++ cfe/trunk/lib/Basic/Diagnostic.cpp Fri Nov 30 17:43:05 2018 @@ -89,6 +89,14 @@ DiagnosticsEngine::~DiagnosticsEngine() setClient(nullptr); } +void DiagnosticsEngine::dump() const { + DiagStatesByLoc.dump(*SourceMgr); +} + +void DiagnosticsEngine::dump(StringRef DiagName) const { + DiagStatesByLoc.dump(*SourceMgr, DiagName); +} + void DiagnosticsEngine::setClient(DiagnosticConsumer *client, bool ShouldOwnClient) { Owner.reset(ShouldOwnClient ? client : nullptr); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r348066 - [clangd] Recommit the "AnyScope" changes in requests.json by rCTE347753 (reverted by rCTE347792)
Author: maskray Date: Fri Nov 30 17:57:15 2018 New Revision: 348066 URL: http://llvm.org/viewvc/llvm-project?rev=348066&view=rev Log: [clangd] Recommit the "AnyScope" changes in requests.json by rCTE347753 (reverted by rCTE347792) This fixes IndexBenchmark tests. Modified: clang-tools-extra/trunk/test/clangd/Inputs/requests.json Modified: clang-tools-extra/trunk/test/clangd/Inputs/requests.json URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clangd/Inputs/requests.json?rev=348066&r1=348065&r2=348066&view=diff == --- clang-tools-extra/trunk/test/clangd/Inputs/requests.json (original) +++ clang-tools-extra/trunk/test/clangd/Inputs/requests.json Fri Nov 30 17:57:15 2018 @@ -1,7 +1,7 @@ -[{"Limit":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"]}, -{"Limit":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, -{"Limit":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, -{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, -{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""]}, -{"Limit":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::", "clang::", "clang::clangd::dex::"]}, -{"Limit":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":[""]}] +[{"Limit":100,"ProximityPaths":["/usr/home/user/clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp"],"Query":"OMP","RestrictForCodeCompletion":true,"Scopes":["clang::"], "AnyScope":false}, +{"Limit":100,"ProximityPaths":[],"Query":"s","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, +{"Limit":100,"ProximityPaths":[],"Query":"sy","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, +{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, +{"Limit":100,"ProximityPaths":[],"Query":"sys","RestrictForCodeCompletion":true,"Scopes":["llvm::", ""], "AnyScope":false}, +{"Limit":100,"ProximityPaths":[],"Query":"Dex","RestrictForCodeCompletion":true,"Scopes":["clang::clangd::", "clang::", "clang::clangd::dex::"],"AnyScope":false}, +{"Limit":100,"ProximityPaths":[],"Query":"Variable","RestrictForCodeCompletion":true,"Scopes":[""], "AnyScope":false}] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r348709 - SourceManager: insert(make_pair(..)) -> try_emplace. NFC
Author: maskray Date: Sat Dec 8 17:46:01 2018 New Revision: 348709 URL: http://llvm.org/viewvc/llvm-project?rev=348709&view=rev Log: SourceManager: insert(make_pair(..)) -> try_emplace. NFC Modified: cfe/trunk/lib/Basic/SourceManager.cpp Modified: cfe/trunk/lib/Basic/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=348709&r1=348708&r2=348709&view=diff == --- cfe/trunk/lib/Basic/SourceManager.cpp (original) +++ cfe/trunk/lib/Basic/SourceManager.cpp Sat Dec 8 17:46:01 2018 @@ -195,8 +195,7 @@ llvm::MemoryBuffer *ContentCache::getBuf } unsigned LineTableInfo::getLineTableFilenameID(StringRef Name) { - auto IterBool = - FilenameIDs.insert(std::make_pair(Name, FilenamesByID.size())); + auto IterBool = FilenameIDs.try_emplace(Name, FilenamesByID.size()); if (IterBool.second) FilenamesByID.push_back(&*IterBool.first); return IterBool.first->second; @@ -1965,9 +1964,7 @@ SourceManager::getDecomposedIncludedLoc( // Uses IncludedLocMap to retrieve/cache the decomposed loc. using DecompTy = std::pair; - using MapTy = llvm::DenseMap; - std::pair -InsertOp = IncludedLocMap.insert(std::make_pair(FID, DecompTy())); + auto InsertOp = IncludedLocMap.try_emplace(FID); DecompTy &DecompLoc = InsertOp.first->second; if (!InsertOp.second) return DecompLoc; // already in map. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r348777 - ComputeLineNumbers: delete SSE2 vectorization
Author: maskray Date: Mon Dec 10 10:10:35 2018 New Revision: 348777 URL: http://llvm.org/viewvc/llvm-project?rev=348777&view=rev Log: ComputeLineNumbers: delete SSE2 vectorization Summary: SSE2 vectorization was added in 2012, but it is 2018 now and I can't observe any performance boost (testing clang -E [all Sema/* CodeGen/* with proper -I options]) with the existing _mm_movemask_epi8+countTrailingZeros or the following SSE4.2 (compiling with -msse4.2): __m128i C = _mm_setr_epi8('\r','\n',0,0,0,0,0,0,0,0,0,0,0,0,0,0); _mm_cmpestri(C, 2, Chunk, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_POSITIVE_POLARITY | _SIDD_LEAST_SIGNIFICANT) Delete the vectorization to simplify the code. Also simplify the code a bit and don't check the line ending sequence \n\r Reviewers: bkramer, #clang Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55484 Modified: cfe/trunk/lib/Basic/SourceManager.cpp Modified: cfe/trunk/lib/Basic/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=348777&r1=348776&r2=348777&view=diff == --- cfe/trunk/lib/Basic/SourceManager.cpp (original) +++ cfe/trunk/lib/Basic/SourceManager.cpp Mon Dec 10 10:10:35 2018 @@ -1216,65 +1216,22 @@ static void ComputeLineNumbers(Diagnosti const unsigned char *Buf = (const unsigned char *)Buffer->getBufferStart(); const unsigned char *End = (const unsigned char *)Buffer->getBufferEnd(); - unsigned Offs = 0; + unsigned I = 0; while (true) { // Skip over the contents of the line. -const unsigned char *NextBuf = (const unsigned char *)Buf; +while (Buf[I] != '\n' && Buf[I] != '\r' && Buf[I] != '\0') + ++I; -#ifdef __SSE2__ -// Try to skip to the next newline using SSE instructions. This is very -// performance sensitive for programs with lots of diagnostics and in -E -// mode. -__m128i CRs = _mm_set1_epi8('\r'); -__m128i LFs = _mm_set1_epi8('\n'); - -// First fix up the alignment to 16 bytes. -while (((uintptr_t)NextBuf & 0xF) != 0) { - if (*NextBuf == '\n' || *NextBuf == '\r' || *NextBuf == '\0') -goto FoundSpecialChar; - ++NextBuf; -} - -// Scan 16 byte chunks for '\r' and '\n'. Ignore '\0'. -while (NextBuf+16 <= End) { - const __m128i Chunk = *(const __m128i*)NextBuf; - __m128i Cmp = _mm_or_si128(_mm_cmpeq_epi8(Chunk, CRs), - _mm_cmpeq_epi8(Chunk, LFs)); - unsigned Mask = _mm_movemask_epi8(Cmp); - - // If we found a newline, adjust the pointer and jump to the handling code. - if (Mask != 0) { -NextBuf += llvm::countTrailingZeros(Mask); -goto FoundSpecialChar; - } - NextBuf += 16; -} -#endif - -while (*NextBuf != '\n' && *NextBuf != '\r' && *NextBuf != '\0') - ++NextBuf; - -#ifdef __SSE2__ -FoundSpecialChar: -#endif -Offs += NextBuf-Buf; -Buf = NextBuf; - -if (Buf[0] == '\n' || Buf[0] == '\r') { - // If this is \n\r or \r\n, skip both characters. - if ((Buf[1] == '\n' || Buf[1] == '\r') && Buf[0] != Buf[1]) { -++Offs; -++Buf; - } - ++Offs; - ++Buf; - LineOffsets.push_back(Offs); +if (Buf[I] == '\n' || Buf[I] == '\r') { + // If this is \r\n, skip both characters. + if (Buf[I] == '\r' && Buf[I+1] == '\n') +++I; + ++I; + LineOffsets.push_back(I); } else { - // Otherwise, this is a null. If end of file, exit. - if (Buf == End) break; - // Otherwise, skip the null. - ++Offs; - ++Buf; + // Otherwise, this is a NUL. If end of file, exit. + if (Buf+I == End) break; + ++I; } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r355176 - Fix file headers. NFC
Author: maskray Date: Thu Feb 28 22:49:51 2019 New Revision: 355176 URL: http://llvm.org/viewvc/llvm-project?rev=355176&view=rev Log: Fix file headers. NFC Modified: cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp cfe/trunk/lib/ARCMigrate/TransformActions.cpp cfe/trunk/lib/Analysis/ReachableCode.cpp cfe/trunk/lib/Basic/XRayLists.cpp cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp cfe/trunk/lib/Driver/ToolChains/BareMetal.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp cfe/trunk/lib/Driver/ToolChains/MSVC.cpp cfe/trunk/lib/Driver/ToolChains/MipsLinux.cpp cfe/trunk/lib/Frontend/FrontendTiming.cpp cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp cfe/trunk/lib/Frontend/Rewrite/RewriteModernObjC.cpp cfe/trunk/lib/Lex/PPMacroExpansion.cpp cfe/trunk/lib/Lex/Preprocessor.cpp cfe/trunk/lib/Sema/SemaCoroutine.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/SVals.cpp cfe/trunk/tools/clang-extdef-mapping/ClangExtDefMapGen.cpp cfe/trunk/tools/clang-import-test/clang-import-test.cpp cfe/trunk/tools/libclang/CIndexDiagnostic.cpp cfe/trunk/tools/libclang/CIndexUSRs.cpp cfe/trunk/tools/libclang/CIndexer.cpp cfe/trunk/tools/libclang/CXStoredDiagnostic.cpp cfe/trunk/tools/libclang/CXType.cpp cfe/trunk/tools/libclang/Indexing.cpp Modified: cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp?rev=355176&r1=355175&r2=355176&view=diff == --- cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp (original) +++ cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp Thu Feb 28 22:49:51 2019 @@ -1,4 +1,4 @@ -//===--- TransEmptyStatements.cpp - Transformations to ARC mode ---===// +//===-- TransEmptyStatementsAndDealloc.cpp - Transformations to ARC mode --===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: cfe/trunk/lib/ARCMigrate/TransformActions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransformActions.cpp?rev=355176&r1=355175&r2=355176&view=diff == --- cfe/trunk/lib/ARCMigrate/TransformActions.cpp (original) +++ cfe/trunk/lib/ARCMigrate/TransformActions.cpp Thu Feb 28 22:49:51 2019 @@ -1,4 +1,4 @@ -//===--- ARCMT.cpp - Migration to ARC mode ===// +//===-- TransformActions.cpp - Migration to ARC mode --===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: cfe/trunk/lib/Analysis/ReachableCode.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ReachableCode.cpp?rev=355176&r1=355175&r2=355176&view=diff == --- cfe/trunk/lib/Analysis/ReachableCode.cpp (original) +++ cfe/trunk/lib/Analysis/ReachableCode.cpp Thu Feb 28 22:49:51 2019 @@ -1,4 +1,4 @@ -//=- ReachableCodePathInsensitive.cpp ---*- C++ --*-==// +//===-- ReachableCode.cpp - Code Reachability Analysis ===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: cfe/trunk/lib/Basic/XRayLists.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/XRayLists.cpp?rev=355176&r1=355175&r2=355176&view=diff == --- cfe/trunk/lib/Basic/XRayLists.cpp (original) +++ cfe/trunk/lib/Basic/XRayLists.cpp Thu Feb 28 22:49:51 2019 @@ -1,4 +1,4 @@ -//===--- XRayFunctionFilter.cpp - XRay automatic-attribution --===// +//===-- XRayLists.cpp - XRay automatic-attribution ===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp?rev=355176&r1=355175&r2=355176&view=diff == --- cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp Thu Feb 28 22:49:51 2019 @@ -1,4 +1,4 @@ -//===--- CodeGenTypes.cpp - TBAA information for LLVM CodeGen
[clang-tools-extra] r355188 - Fix file headers. NFC
Author: maskray Date: Fri Mar 1 01:52:53 2019 New Revision: 355188 URL: http://llvm.org/viewvc/llvm-project?rev=355188&view=rev Log: Fix file headers. NFC Modified: clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp clang-tools-extra/trunk/clang-doc/Generators.cpp clang-tools-extra/trunk/clang-doc/Serialize.cpp clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp clang-tools-extra/trunk/clang-move/HelperDeclRefGraph.cpp clang-tools-extra/trunk/clang-tidy/cert/CommandProcessorCheck.cpp clang-tools-extra/trunk/clang-tidy/cert/StrToNumCheck.cpp clang-tools-extra/trunk/clang-tidy/cert/VariadicFunctionDefCheck.cpp clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp clang-tools-extra/trunk/clang-tidy/performance/PerformanceTidyModule.cpp clang-tools-extra/trunk/clang-tidy/readability/FunctionSizeCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/SimplifyBooleanExprCheck.cpp clang-tools-extra/trunk/clang-tidy/readability/StringCompareCheck.cpp clang-tools-extra/trunk/clang-tidy/utils/OptionsUtils.cpp clang-tools-extra/trunk/clangd/index/YAMLSerialization.cpp clang-tools-extra/trunk/clangd/xpc/framework/ClangdXPC.cpp clang-tools-extra/trunk/clangd/xpc/test-client/ClangdXPCTestClient.cpp clang-tools-extra/trunk/unittests/clang-move/ClangMoveTests.cpp clang-tools-extra/trunk/unittests/clang-query/QueryEngineTest.cpp clang-tools-extra/trunk/unittests/clangd/FunctionTests.cpp clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp clang-tools-extra/trunk/unittests/clangd/TestIndex.cpp Modified: clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp?rev=355188&r1=355187&r2=355188&view=diff == --- clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp (original) +++ clang-tools-extra/trunk/change-namespace/tool/ClangChangeNamespace.cpp Fri Mar 1 01:52:53 2019 @@ -1,4 +1,4 @@ -//===-- ClangIncludeFixer.cpp - Standalone change namespace ---===// +//===-- ClangChangeNamespace.cpp - Standalone change namespace ===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: clang-tools-extra/trunk/clang-doc/Generators.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/Generators.cpp?rev=355188&r1=355187&r2=355188&view=diff == --- clang-tools-extra/trunk/clang-doc/Generators.cpp (original) +++ clang-tools-extra/trunk/clang-doc/Generators.cpp Fri Mar 1 01:52:53 2019 @@ -1,4 +1,4 @@ -//=== Generator.cpp - Generator Registry -*- C++-*-===// +//===-- Generators.cpp - Generator Registry --*- C++-*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: clang-tools-extra/trunk/clang-doc/Serialize.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/Serialize.cpp?rev=355188&r1=355187&r2=355188&view=diff == --- clang-tools-extra/trunk/clang-doc/Serialize.cpp (original) +++ clang-tools-extra/trunk/clang-doc/Serialize.cpp Fri Mar 1 01:52:53 2019 @@ -1,4 +1,4 @@ -//===-- Serializer.cpp - ClangDoc Serializer *- C++ -*-===// +//===-- Serialize.cpp - ClangDoc Serializer -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp?rev=355188&r1=355187&r2=355188&view=diff == --- clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp (original) +++ clang-tools-extra/trunk/clang-doc/YAMLGenerator.cpp Fri Mar 1 01:52:53 2019 @@ -1,4 +1,4 @@ -//===-- ClangDocYAML.cpp - ClangDoc YAML ---*- C++ -*-===// +//===-- YAMLGenerator.cpp - ClangDoc YAML ---*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. Modified: clang-tools-extra/trunk/clang-move/HelperDeclRefGraph.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/HelperDeclRefGraph.cpp?rev=355188&r1=355187&r2=355188&view=diff =
r356005 - Delete unused declaration of DeclContextPrintAction after the removal of -print-decl-contexts by D52529
Author: maskray Date: Tue Mar 12 20:22:33 2019 New Revision: 356005 URL: http://llvm.org/viewvc/llvm-project?rev=356005&view=rev Log: Delete unused declaration of DeclContextPrintAction after the removal of -print-decl-contexts by D52529 Modified: cfe/trunk/include/clang/Frontend/FrontendActions.h Modified: cfe/trunk/include/clang/Frontend/FrontendActions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendActions.h?rev=356005&r1=356004&r2=356005&view=diff == --- cfe/trunk/include/clang/Frontend/FrontendActions.h (original) +++ cfe/trunk/include/clang/Frontend/FrontendActions.h Tue Mar 12 20:22:33 2019 @@ -74,12 +74,6 @@ protected: StringRef InFile) override; }; -class DeclContextPrintAction : public ASTFrontendAction { -protected: - std::unique_ptr CreateASTConsumer(CompilerInstance &CI, - StringRef InFile) override; -}; - class GeneratePCHAction : public ASTFrontendAction { protected: std::unique_ptr CreateASTConsumer(CompilerInstance &CI, ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r356366 - [pp-trace] Delete -ignore and add a new option -callbacks
Author: maskray Date: Mon Mar 18 06:30:17 2019 New Revision: 356366 URL: http://llvm.org/viewvc/llvm-project?rev=356366&view=rev Log: [pp-trace] Delete -ignore and add a new option -callbacks Summary: -ignore specifies a list of PP callbacks to ignore. It cannot express a whitelist, which may be more useful than a blacklist. Add a new option -callbacks to replace it. -ignore= (default) => -callbacks='*' (default) -ignore=FileChanged,FileSkipped => -callbacks='*,-FileChanged,-FileSkipped' -callbacks='Macro*' : print only MacroDefined,MacroExpands,MacroUndefined,... Reviewers: juliehockett, aaron.ballman, alexfh, ioeric Reviewed By: aaron.ballman Subscribers: nemanjai, kbarton, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59296 Added: clang-tools-extra/trunk/test/pp-trace/pp-trace-filter.cpp Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst clang-tools-extra/trunk/docs/pp-trace.rst clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.h clang-tools-extra/trunk/pp-trace/PPTrace.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-conditional.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-ident.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-macro.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-modules.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-pragma-general.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-pragma-ms.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-pragma-opencl.cpp Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=356366&r1=356365&r2=356366&view=diff == --- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original) +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Mon Mar 18 06:30:17 2019 @@ -132,3 +132,9 @@ Improvements to modularize -- The improvements are... + +Improvements to pp-trace + + +- Added a new option `-callbacks` to filter preprocessor callbacks. It replaces + the `-ignore` option. Modified: clang-tools-extra/trunk/docs/pp-trace.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/pp-trace.rst?rev=356366&r1=356365&r2=356366&view=diff == --- clang-tools-extra/trunk/docs/pp-trace.rst (original) +++ clang-tools-extra/trunk/docs/pp-trace.rst Mon Mar 18 06:30:17 2019 @@ -40,12 +40,12 @@ which must follow the . Command Line Options -.. option:: -ignore +.. option:: -callbacks - This option specifies a comma-separated list of names of callbacks - that shouldn't be traced. It can be used to eliminate unwanted - trace output. The callback names are the name of the actual - callback function names in the PPCallbacks class: + This option specifies a comma-separated list of globs describing the list of + callbacks that should be traced. Globs are processed in order of appearance. + Positive globs add matched callbacks to the set, netative globs (those with + the '-' prefix) remove callacks from the set. * FileChanged * FileSkipped Modified: clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp?rev=356366&r1=356365&r2=356366&view=diff == --- clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp (original) +++ clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp Mon Mar 18 06:30:17 2019 @@ -88,10 +88,10 @@ static const char *const MappingStrings[ // PPCallbacksTracker functions. -PPCallbacksTracker::PPCallbacksTracker(llvm::SmallSet &Ignore, +PPCallbacksTracker::PPCallbacksTracker(const FilterType &Filters, std::vector &CallbackCalls, clang::Preprocessor &PP) -: CallbackCalls(CallbackCalls), Ignore(Ignore), PP(PP) {} +: CallbackCalls(CallbackCalls), Filters(Filters), PP(PP) {} PPCallbacksTracker::~PPCallbacksTracker() {} @@ -425,7 +425,14 @@ void PPCallbacksTracker::Endif(clang::So // Start a new callback. void PPCallbacksTracker::beginCallback(const char *Name) { - DisableTrace = Ignore.count(std::string(Name)); + auto R = CallbackIsEnabled.try_emplace(Name, false); + if (R.second) { +llvm::StringRef N(Name); +for (const std::pair &Filter : Filters) + if (Filter.first.match(N)) +R.first->second = Filter.second; + } + DisableTrace = !R.first->second; if (DisableTrace) return; CallbackCalls.push_back(CallbackCall(Name)); Modified: clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-ex
[clang-tools-extra] r356849 - [pp-trace] Modernize the code
Author: maskray Date: Sat Mar 23 23:55:08 2019 New Revision: 356849 URL: http://llvm.org/viewvc/llvm-project?rev=356849&view=rev Log: [pp-trace] Modernize the code Use InitLLVM and WithColor Delete PPTraceConsumer, add the callback in PPTraceAction Migrae to tooling::createExecutorFromCommandLineArgs Don't specialize empty OutputFileName Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-conditional.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-filter.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-ident.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-include.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-macro.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-modules.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-pragma-general.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-pragma-ms.cpp clang-tools-extra/trunk/test/pp-trace/pp-trace-pragma-opencl.cpp Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPTrace.cpp?rev=356849&r1=356848&r2=356849&view=diff == --- clang-tools-extra/trunk/pp-trace/PPTrace.cpp (original) +++ clang-tools-extra/trunk/pp-trace/PPTrace.cpp Sat Mar 23 23:55:08 2019 @@ -34,6 +34,7 @@ #include "clang/Frontend/FrontendActions.h" #include "clang/Lex/Preprocessor.h" #include "clang/Tooling/CompilationDatabase.h" +#include "clang/Tooling/Execution.h" #include "clang/Tooling/Tooling.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" @@ -42,6 +43,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/GlobPattern.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/ToolOutputFile.h" @@ -56,108 +58,79 @@ using namespace clang; using namespace clang::tooling; using namespace llvm; -// Options: - -// Collect the source files. -static cl::list SourcePaths(cl::Positional, - cl::desc(" [... ]"), - cl::OneOrMore); +static cl::OptionCategory Cat("pp-trace options"); static cl::opt Callbacks( "callbacks", cl::init("*"), cl::desc("Comma-separated list of globs describing the list of callbacks " "to output. Globs are processed in order of appearance. Globs " "with the '-' prefix remove callbacks from the set. e.g. " - "'*,-Macro*'.")); + "'*,-Macro*'."), +cl::cat(Cat)); -// Option to specify the trace output file name. static cl::opt OutputFileName( -"output", cl::init(""), -cl::desc("Output trace to the given file name or '-' for stdout.")); - -// Collect all other arguments, which will be passed to the front end. -static cl::list -CC1Arguments(cl::ConsumeAfter, - cl::desc("...")); - -// Frontend action stuff: +"output", cl::init("-"), +cl::desc("Output trace to the given file name or '-' for stdout."), +cl::cat(Cat)); + +LLVM_ATTRIBUTE_NORETURN static void error(Twine Message) { + WithColor::error() << Message << '\n'; + exit(1); +} namespace { -// Consumer is responsible for setting up the callbacks. -class PPTraceConsumer : public ASTConsumer { -public: - PPTraceConsumer(const FilterType &Filters, - std::vector &CallbackCalls, Preprocessor &PP) { -// PP takes ownership. -PP.addPPCallbacks( -llvm::make_unique(Filters, CallbackCalls, PP)); - } -}; -class PPTraceAction : public SyntaxOnlyAction { +class PPTraceAction : public ASTFrontendAction { public: - PPTraceAction(const FilterType &Filters, -std::vector &CallbackCalls) - : Filters(Filters), CallbackCalls(CallbackCalls) {} + PPTraceAction(const FilterType &Filters, raw_ostream &OS) + : Filters(Filters), OS(OS) {} protected: std::unique_ptr CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { -return llvm::make_unique(Filters, CallbackCalls, - CI.getPreprocessor()); +Preprocessor &PP = CI.getPreprocessor(); +PP.addPPCallbacks( +make_unique(Filters, CallbackCalls, PP)); +return make_unique(); + } + + void EndSourceFileAction() override { +OS << "---\n"; +for (const CallbackCall &Callback : CallbackCalls) { + OS << "- Callback: " << Callback.Name << "\n"; + for (const Argument &Arg : Callback.Arguments) +OS << " " << Arg.Name << ": " << Arg.Value << "\n"; +} +OS << "...\n"; + +CallbackCalls.clear(); } private: const FilterType &Filters; - std::vector &CallbackCalls; + raw_ostream &OS; + std::vector CallbackCalls; }; class PPTraceFrontendActionFactory : public FrontendActionFactory { public: - PPTraceFrontendActionFactor
[clang-tools-extra] r356850 - [pp-trace] Wrap code in clang::pp_trace
Author: maskray Date: Sun Mar 24 00:21:32 2019 New Revision: 356850 URL: http://llvm.org/viewvc/llvm-project?rev=356850&view=rev Log: [pp-trace] Wrap code in clang::pp_trace Modified: clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.h clang-tools-extra/trunk/pp-trace/PPTrace.cpp Modified: clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp?rev=356850&r1=356849&r2=356850&view=diff == --- clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp (original) +++ clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp Sun Mar 24 00:21:32 2019 @@ -17,7 +17,8 @@ #include "clang/Lex/MacroArgs.h" #include "llvm/Support/raw_ostream.h" -// Utility functions. +namespace clang { +namespace pp_trace { // Get a "file:line:column" source location string. static std::string getSourceLocationString(clang::Preprocessor &PP, @@ -455,7 +456,7 @@ void PPCallbacksTracker::appendArgument( void PPCallbacksTracker::appendArgument(const char *Name, const char *Value) { if (DisableTrace) return; - CallbackCalls.back().Arguments.push_back(Argument(Name, Value)); + CallbackCalls.back().Arguments.push_back(Argument{Name, Value}); } // Append a string object argument to the top trace item. @@ -674,3 +675,6 @@ PPCallbacksTracker::getSourceString(clan const char *E = PP.getSourceManager().getCharacterData(Range.getEnd()); return llvm::StringRef(B, E - B); } + +} // namespace pp_trace +} // namespace clang Modified: clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.h?rev=356850&r1=356849&r2=356850&view=diff == --- clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.h (original) +++ clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.h Sun Mar 24 00:21:32 2019 @@ -32,14 +32,11 @@ #include #include -/// \brief This class represents one callback function argument by name -/// and value. -class Argument { -public: - Argument(llvm::StringRef Name, llvm::StringRef Value) - : Name(Name), Value(Value) {} - Argument() = default; +namespace clang { +namespace pp_trace { +// This struct represents one callback function argument by name and value. +struct Argument { std::string Name; std::string Value; }; @@ -74,7 +71,7 @@ using FilterType = std::vector &CallbackCalls, - clang::Preprocessor &PP); + Preprocessor &PP); ~PPCallbacksTracker() override; // Overidden callback functions. - void FileChanged(clang::SourceLocation Loc, - clang::PPCallbacks::FileChangeReason Reason, - clang::SrcMgr::CharacteristicKind FileType, - clang::FileID PrevFID = clang::FileID()) override; - void FileSkipped(const clang::FileEntry &SkippedFile, - const clang::Token &FilenameTok, - clang::SrcMgr::CharacteristicKind FileType) override; + void FileChanged(SourceLocation Loc, PPCallbacks::FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType, + FileID PrevFID = FileID()) override; + void FileSkipped(const FileEntry &SkippedFile, const Token &FilenameTok, + SrcMgr::CharacteristicKind FileType) override; bool FileNotFound(llvm::StringRef FileName, llvm::SmallVectorImpl &RecoveryPath) override; - void InclusionDirective(clang::SourceLocation HashLoc, - const clang::Token &IncludeTok, + void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, llvm::StringRef FileName, bool IsAngled, - clang::CharSourceRange FilenameRange, - const clang::FileEntry *File, + CharSourceRange FilenameRange, const FileEntry *File, llvm::StringRef SearchPath, - llvm::StringRef RelativePath, - const clang::Module *Imported, - clang::SrcMgr::CharacteristicKind FileType) override; - void moduleImport(clang::SourceLocation ImportLoc, clang::ModuleIdPath Path, -const clang::Module *Imported) override; + llvm::StringRef RelativePath, const Module *Imported, + SrcMgr::CharacteristicKind FileType) override; + void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path, +const Module *Imported) override; void EndOfMainFile() override; - void Ident(clang::SourceLocation Loc, llvm::StringRef str) override; - void PragmaDirective(clang::SourceLocation Loc, -
[clang-tools-extra] r356851 - [pp-trace] Delete redundant clang::
Author: maskray Date: Sun Mar 24 00:31:21 2019 New Revision: 356851 URL: http://llvm.org/viewvc/llvm-project?rev=356851&view=rev Log: [pp-trace] Delete redundant clang:: And clarify command line options Modified: clang-tools-extra/trunk/docs/pp-trace.rst clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp clang-tools-extra/trunk/pp-trace/PPTrace.cpp Modified: clang-tools-extra/trunk/docs/pp-trace.rst URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/pp-trace.rst?rev=356851&r1=356850&r2=356851&view=diff == --- clang-tools-extra/trunk/docs/pp-trace.rst (original) +++ clang-tools-extra/trunk/docs/pp-trace.rst Sun Mar 24 00:31:21 2019 @@ -23,7 +23,7 @@ pp-trace Usage Command Line Format --- -``pp-trace [] []`` +``pp-trace [] [-- ]`` is a place-holder for options specific to pp-trace, which are described below in Modified: clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp?rev=356851&r1=356850&r2=356851&view=diff == --- clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp (original) +++ clang-tools-extra/trunk/pp-trace/PPCallbacksTracker.cpp Sun Mar 24 00:31:21 2019 @@ -21,13 +21,13 @@ namespace clang { namespace pp_trace { // Get a "file:line:column" source location string. -static std::string getSourceLocationString(clang::Preprocessor &PP, - clang::SourceLocation Loc) { +static std::string getSourceLocationString(Preprocessor &PP, + SourceLocation Loc) { if (Loc.isInvalid()) return std::string("(none)"); if (Loc.isFileID()) { -clang::PresumedLoc PLoc = PP.getSourceManager().getPresumedLoc(Loc); +PresumedLoc PLoc = PP.getSourceManager().getPresumedLoc(Loc); if (PLoc.isInvalid()) { return std::string("(invalid)"); @@ -91,7 +91,7 @@ static const char *const MappingStrings[ PPCallbacksTracker::PPCallbacksTracker(const FilterType &Filters, std::vector &CallbackCalls, - clang::Preprocessor &PP) + Preprocessor &PP) : CallbackCalls(CallbackCalls), Filters(Filters), PP(PP) {} PPCallbacksTracker::~PPCallbacksTracker() {} @@ -99,9 +99,10 @@ PPCallbacksTracker::~PPCallbacksTracker( // Callback functions. // Callback invoked whenever a source file is entered or exited. -void PPCallbacksTracker::FileChanged( -clang::SourceLocation Loc, clang::PPCallbacks::FileChangeReason Reason, -clang::SrcMgr::CharacteristicKind FileType, clang::FileID PrevFID) { +void PPCallbacksTracker::FileChanged(SourceLocation Loc, + PPCallbacks::FileChangeReason Reason, + SrcMgr::CharacteristicKind FileType, + FileID PrevFID) { beginCallback("FileChanged"); appendArgument("Loc", Loc); appendArgument("Reason", Reason, FileChangeReasonStrings); @@ -111,10 +112,9 @@ void PPCallbacksTracker::FileChanged( // Callback invoked whenever a source file is skipped as the result // of header guard optimization. -void -PPCallbacksTracker::FileSkipped(const clang::FileEntry &SkippedFile, -const clang::Token &FilenameTok, -clang::SrcMgr::CharacteristicKind FileType) { +void PPCallbacksTracker::FileSkipped(const FileEntry &SkippedFile, + const Token &FilenameTok, + SrcMgr::CharacteristicKind FileType) { beginCallback("FileSkipped"); appendArgument("ParentFile", &SkippedFile); appendArgument("FilenameTok", FilenameTok); @@ -135,11 +135,10 @@ PPCallbacksTracker::FileNotFound(llvm::S // any kind (#include, #import, etc.) has been processed, regardless // of whether the inclusion will actually result in an inclusion. void PPCallbacksTracker::InclusionDirective( -clang::SourceLocation HashLoc, const clang::Token &IncludeTok, -llvm::StringRef FileName, bool IsAngled, -clang::CharSourceRange FilenameRange, const clang::FileEntry *File, +SourceLocation HashLoc, const Token &IncludeTok, llvm::StringRef FileName, +bool IsAngled, CharSourceRange FilenameRange, const FileEntry *File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, -const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) { +const Module *Imported, SrcMgr::CharacteristicKind FileType) { beginCallback("InclusionDirective"); appendArgument("IncludeTok", IncludeTok); appendFilePathArgument("FileName", FileName); @@ -153,9 +152,9 @@ void PPCallbacksTracker::InclusionDirect // Callback invoked
[clang-tools-extra] r356887 - [pp-trace] Try fixing MSVC C2248 after rCTE356849
Author: maskray Date: Mon Mar 25 04:40:11 2019 New Revision: 356887 URL: http://llvm.org/viewvc/llvm-project?rev=356887&view=rev Log: [pp-trace] Try fixing MSVC C2248 after rCTE356849 Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPTrace.cpp?rev=356887&r1=356886&r2=356887&view=diff == --- clang-tools-extra/trunk/pp-trace/PPTrace.cpp (original) +++ clang-tools-extra/trunk/pp-trace/PPTrace.cpp Mon Mar 25 04:40:11 2019 @@ -150,8 +150,8 @@ int main(int argc, const char **argv) { if (EC) error(EC.message()); - if (Error Err = Exec->get()->execute( - llvm::make_unique(Filters, Out.os( + if (auto Err = Exec->get()->execute( + llvm::make_unique(Filters, Out.os( error(toString(std::move(Err))); Out.keep(); return 0; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357001 - [CodeGen] Delete never used LValueAlign
Author: maskray Date: Tue Mar 26 08:39:45 2019 New Revision: 357001 URL: http://llvm.org/viewvc/llvm-project?rev=357001&view=rev Log: [CodeGen] Delete never used LValueAlign It was added by rC176658 but never used since then. Modified: cfe/trunk/lib/CodeGen/CGAtomic.cpp Modified: cfe/trunk/lib/CodeGen/CGAtomic.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGAtomic.cpp?rev=357001&r1=357000&r2=357001&view=diff == --- cfe/trunk/lib/CodeGen/CGAtomic.cpp (original) +++ cfe/trunk/lib/CodeGen/CGAtomic.cpp Tue Mar 26 08:39:45 2019 @@ -35,7 +35,6 @@ namespace { uint64_t ValueSizeInBits; CharUnits AtomicAlign; CharUnits ValueAlign; -CharUnits LValueAlign; TypeEvaluationKind EvaluationKind; bool UseLibcall; LValue LVal; @@ -132,7 +131,6 @@ namespace { QualType getAtomicType() const { return AtomicTy; } QualType getValueType() const { return ValueTy; } CharUnits getAtomicAlignment() const { return AtomicAlign; } -CharUnits getValueAlignment() const { return ValueAlign; } uint64_t getAtomicSizeInBits() const { return AtomicSizeInBits; } uint64_t getValueSizeInBits() const { return ValueSizeInBits; } TypeEvaluationKind getEvaluationKind() const { return EvaluationKind; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357150 - [Driver] Allow -gsplit-dwarf on ELF OSes other than Linux and Fuchsia
Author: maskray Date: Thu Mar 28 01:24:00 2019 New Revision: 357150 URL: http://llvm.org/viewvc/llvm-project?rev=357150&view=rev Log: [Driver] Allow -gsplit-dwarf on ELF OSes other than Linux and Fuchsia In gcc, -gsplit-dwarf is handled in gcc/gcc.c as a spec (ASM_FINAL_SPEC): objcopy --extract-dwo + objcopy --strip-dwo. In gcc/opts.c, -gsplit_dwarf has the same semantic of a -g. Except for the availability of the external command 'objcopy', nothing precludes the feature working on other ELF OSes. llvm doesn't use objcopy, so it doesn't have to exclude other OSes. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/split-debug.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=357150&r1=357149&r2=357150&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Thu Mar 28 01:24:00 2019 @@ -3260,8 +3260,7 @@ static void RenderDebugOptions(const Too // -gsplit-dwarf should turn on -g and enable the backend dwarf // splitting and extraction. - // FIXME: Currently only works on Linux and Fuchsia. - if (T.isOSLinux() || T.isOSFuchsia()) { + if (T.isOSBinFormatELF()) { if (!SplitDWARFInlining) CmdArgs.push_back("-fno-split-dwarf-inlining"); @@ -4077,7 +4076,7 @@ void Clang::ConstructJob(Compilation &C, // Add the split debug info name to the command lines here so we // can propagate it to the backend. bool SplitDWARF = (DwarfFission != DwarfFissionKind::None) && -(RawTriple.isOSLinux() || RawTriple.isOSFuchsia()) && +TC.getTriple().isOSBinFormatELF() && (isa(JA) || isa(JA) || isa(JA)); const char *SplitDWARFOut; @@ -6134,8 +6133,8 @@ void ClangAs::ConstructJob(Compilation & const llvm::Triple &T = getToolChain().getTriple(); Arg *A; - if ((getDebugFissionKind(D, Args, A) == DwarfFissionKind::Split) && - (T.isOSLinux() || T.isOSFuchsia())) { + if (getDebugFissionKind(D, Args, A) == DwarfFissionKind::Split && + T.isOSBinFormatELF()) { CmdArgs.push_back("-split-dwarf-file"); CmdArgs.push_back(SplitDebugName(Args, Input, Output)); } Modified: cfe/trunk/test/Driver/split-debug.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/split-debug.c?rev=357150&r1=357149&r2=357150&view=diff == --- cfe/trunk/test/Driver/split-debug.c (original) +++ cfe/trunk/test/Driver/split-debug.c Thu Mar 28 01:24:00 2019 @@ -35,6 +35,9 @@ // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -c -### %s 2> %t // RUN: FileCheck -check-prefix=CHECK-OPTION < %t %s // +// RUN: %clang -target x86_64-pc-freebsd12 -gsplit-dwarf -c -### %s 2> %t +// RUN: FileCheck -check-prefix=CHECK-OPTION < %t %s +// // CHECK-OPTION: "-split-dwarf-file" "split-debug.dwo" // RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -S -### %s 2> %t ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357151 - Fix tests after rC357150
Author: maskray Date: Thu Mar 28 01:41:17 2019 New Revision: 357151 URL: http://llvm.org/viewvc/llvm-project?rev=357151&view=rev Log: Fix tests after rC357150 Modified: cfe/trunk/test/Driver/cuda-unsupported-debug-options.cu cfe/trunk/test/Driver/openmp-unsupported-debug-options.c Modified: cfe/trunk/test/Driver/cuda-unsupported-debug-options.cu URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cuda-unsupported-debug-options.cu?rev=357151&r1=357150&r2=357151&view=diff == --- cfe/trunk/test/Driver/cuda-unsupported-debug-options.cu (original) +++ cfe/trunk/test/Driver/cuda-unsupported-debug-options.cu Thu Mar 28 01:41:17 2019 @@ -17,6 +17,6 @@ // CHECK: debug information option '{{-gz|-fdebug-info-for-profiling|-gsplit-dwarf|-glldb|-gcodeview|-gmodules|-gembed-source|-fdebug-macro|-ggnu-pubnames|-gdwarf-aranges|-fdebug-types-section}}' is not supported for target 'nvptx64-nvidia-cuda' [-Wunsupported-target-opt] // CHECK-NOT: debug information option '{{.*}}' is not supported for target 'x86 // CHECK: "-triple" "nvptx64-nvidia-cuda" -// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} +// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} // CHECK: "-triple" "x86_64 // CHECK-SAME: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} Modified: cfe/trunk/test/Driver/openmp-unsupported-debug-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openmp-unsupported-debug-options.c?rev=357151&r1=357150&r2=357151&view=diff == --- cfe/trunk/test/Driver/openmp-unsupported-debug-options.c (original) +++ cfe/trunk/test/Driver/openmp-unsupported-debug-options.c Thu Mar 28 01:41:17 2019 @@ -17,6 +17,6 @@ // CHECK: debug information option '{{-gz|-fdebug-info-for-profiling|-gsplit-dwarf|-glldb|-gcodeview|-gmodules|-gembed-source|-fdebug-macro|-ggnu-pubnames|-gdwarf-aranges|-fdebug-types-section}}' is not supported for target 'nvptx64-nvidia-cuda' [-Wunsupported-target-opt] // CHECK-NOT: debug information option '{{.*}}' is not supported for target 'x86 // CHECK: "-triple" "nvptx64-nvidia-cuda" -// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} +// CHECK-NOT: {{-compress-debug|-fdebug-info-for-profiling|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} // CHECK: "-triple" "x86_64 // CHECK-SAME: {{-compress-debug|-fdebug-info-for-profiling|split-dwarf|lldb|codeview|module-format|embed-source|debug-info-macro|gnu-pubnames|generate-arange-section|generate-type-units}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357348 - [cmake] Change deprecated $ to $. NFC
Author: maskray Date: Sat Mar 30 07:38:51 2019 New Revision: 357348 URL: http://llvm.org/viewvc/llvm-project?rev=357348&view=rev Log: [cmake] Change deprecated $ to $. NFC See rL357338 for a similar change. The informational expression $ has been deprecated since CMake 3.0 Modified: cfe/trunk/runtime/CMakeLists.txt Modified: cfe/trunk/runtime/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=357348&r1=357347&r2=357348&view=diff == --- cfe/trunk/runtime/CMakeLists.txt (original) +++ cfe/trunk/runtime/CMakeLists.txt Sat Mar 30 07:38:51 2019 @@ -18,7 +18,7 @@ function(get_ext_project_build_command o set(${out_var} "$(MAKE)" "${target}" PARENT_SCOPE) else() set(${out_var} ${CMAKE_COMMAND} --build . --target ${target} ---config $ PARENT_SCOPE) +--config $ PARENT_SCOPE) endif() endfunction() ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357359 - Range-style std::find{,_if} -> llvm::find{,_if}. NFC
Author: maskray Date: Sun Mar 31 01:48:19 2019 New Revision: 357359 URL: http://llvm.org/viewvc/llvm-project?rev=357359&view=rev Log: Range-style std::find{,_if} -> llvm::find{,_if}. NFC Modified: cfe/trunk/include/clang/AST/DeclContextInternals.h cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h cfe/trunk/lib/ARCMigrate/ARCMT.cpp cfe/trunk/lib/AST/CXXInheritance.cpp cfe/trunk/lib/AST/DeclCXX.cpp cfe/trunk/lib/AST/MicrosoftMangle.cpp cfe/trunk/lib/AST/RecordLayoutBuilder.cpp cfe/trunk/lib/AST/VTableBuilder.cpp cfe/trunk/lib/Basic/Targets/ARM.cpp cfe/trunk/lib/Basic/Targets/PPC.cpp cfe/trunk/lib/Basic/Targets/Sparc.h cfe/trunk/lib/Basic/Targets/X86.cpp cfe/trunk/lib/Driver/Job.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp cfe/trunk/lib/Edit/EditedSource.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/TextDiagnostic.cpp cfe/trunk/lib/Index/IndexingContext.cpp cfe/trunk/lib/Lex/PPDirectives.cpp cfe/trunk/lib/Lex/Preprocessor.cpp cfe/trunk/lib/Sema/SemaAccess.cpp cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaLookup.cpp cfe/trunk/lib/Sema/SemaObjCProperty.cpp cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ModuleManager.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/MIGChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp cfe/trunk/tools/driver/driver.cpp cfe/trunk/tools/libclang/CIndexHigh.cpp cfe/trunk/tools/libclang/CXCursor.cpp cfe/trunk/unittests/AST/ASTImporterTest.cpp cfe/trunk/unittests/Tooling/ToolingTest.cpp Modified: cfe/trunk/include/clang/AST/DeclContextInternals.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclContextInternals.h?rev=357359&r1=357358&r2=357359&view=diff == --- cfe/trunk/include/clang/AST/DeclContextInternals.h (original) +++ cfe/trunk/include/clang/AST/DeclContextInternals.h Sun Mar 31 01:48:19 2019 @@ -113,12 +113,11 @@ public: } DeclsTy &Vec = *getAsVector(); -DeclsTy::iterator I = std::find(Vec.begin(), Vec.end(), D); +DeclsTy::iterator I = llvm::find(Vec, D); assert(I != Vec.end() && "list does not contain decl"); Vec.erase(I); -assert(std::find(Vec.begin(), Vec.end(), D) - == Vec.end() && "list still contains decl"); +assert(llvm::find(Vec, D) == Vec.end() && "list still contains decl"); } /// Remove any declarations which were imported from an external Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h?rev=357359&r1=357358&r2=357359&view=diff == --- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h (original) +++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h Sun Mar 31 01:48:19 2019 @@ -1604,7 +1604,7 @@ public: /// Return the index of BB, or Predecessors.size if BB is not a predecessor. unsigned findPredecessorIndex(const BasicBlock *BB) const { -auto I = std::find(Predecessors.cbegin(), Predecessors.cend(), BB); +auto I = llvm::find(Predecessors, BB); return std::distance(Predecessors.cbegin(), I); } Modified: cfe/trunk/lib/ARCMigrate/ARCMT.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ARCMT.cpp?rev=357359&r1=357358&r2=357359&view=diff == --- cfe/trunk/lib/ARCMigrate/ARCMT.cpp (original) +++ cfe/trunk/lib/ARCMigrate/ARCMT.cpp Sun Mar 31 01:48:19 2019 @@ -64,10 +64,10 @@ bool CapturedDiagList::hasDiagnostic(Arr while (I != List.end()) { FullSourceLoc diagLoc = I->getLocation(); if ((IDs.empty() || // empty means any diagnostic in the range. - std::find(IDs.begin(), IDs.end(), I->getID()) != IDs.end()) && + llvm::find(IDs, I->getID()) != IDs.end()) && !diagLoc.isBeforeInTranslationUnitThan(range.getBegin()) && (diagLoc == range.getEnd() || - diagLoc.isBeforeInTranslationUnitThan(range.getEnd( { + diagLoc.isBeforeInTranslationUnitThan(range.getEnd( { return true; } Modified: cfe/trunk/lib/AST/CXXInheritance.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXInheritance.cpp?rev=357359&r1=357358&r2=357359&view=diff == --- cfe/trunk/lib/AST/CXXInheritance.cpp (original) +++ cfe/trunk/lib/AST/CXXInheritance.cpp Sun Mar 31 01:48:19 2019 @@ -554,8 +554,7 @@ void OverridingMethods::add(unsigned Ove UniqueVirtualMethod Overriding) { SmallVectorImpl &S
r357562 - [libclang][test] Suppress annoying 'LIBCLANG TOOLING ERROR' output
Author: maskray Date: Wed Apr 3 00:25:04 2019 New Revision: 357562 URL: http://llvm.org/viewvc/llvm-project?rev=357562&view=rev Log: [libclang][test] Suppress annoying 'LIBCLANG TOOLING ERROR' output check-all invokes check-clang-python which prints the annoying message: LIBCLANG TOOLING ERROR: fixed-compilation-database: Error while opening fixed database: No such file or directory json-compilation-database: Error while opening JSON database: No such file or directory Let's fix it now with os.dup os.dup2 trick. Modified: cfe/trunk/bindings/python/tests/cindex/test_cdb.py Modified: cfe/trunk/bindings/python/tests/cindex/test_cdb.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_cdb.py?rev=357562&r1=357561&r2=357562&view=diff == --- cfe/trunk/bindings/python/tests/cindex/test_cdb.py (original) +++ cfe/trunk/bindings/python/tests/cindex/test_cdb.py Wed Apr 3 00:25:04 2019 @@ -23,8 +23,17 @@ class TestCDB(unittest.TestCase): def test_create_fail(self): """Check we fail loading a database with an assertion""" path = os.path.dirname(__file__) + +# clang_CompilationDatabase_fromDirectory calls fprintf(stderr, ...) +# Suppress its output. +stderr = os.dup(2) +with open(os.devnull, 'wb') as null: +os.dup2(null.fileno(), 2) with self.assertRaises(CompilationDatabaseError) as cm: cdb = CompilationDatabase.fromDirectory(path) +os.dup2(stderr, 2) +os.close(stderr) + e = cm.exception self.assertEqual(e.cdb_error, CompilationDatabaseError.ERROR_CANNOTLOADDATABASE) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r358094 - [clangd] Use #if CLANGD_BUILD_XPC because it may be defined as 0
Author: maskray Date: Wed Apr 10 08:45:54 2019 New Revision: 358094 URL: http://llvm.org/viewvc/llvm-project?rev=358094&view=rev Log: [clangd] Use #if CLANGD_BUILD_XPC because it may be defined as 0 Modified: clang-tools-extra/trunk/clangd/Transport.h Modified: clang-tools-extra/trunk/clangd/Transport.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Transport.h?rev=358094&r1=358093&r2=358094&view=diff == --- clang-tools-extra/trunk/clangd/Transport.h (original) +++ clang-tools-extra/trunk/clangd/Transport.h Wed Apr 10 08:45:54 2019 @@ -85,7 +85,7 @@ newJSONTransport(std::FILE *In, llvm::ra llvm::raw_ostream *InMirror, bool Pretty, JSONStreamStyle = JSONStreamStyle::Standard); -#ifdef CLANGD_BUILD_XPC +#if CLANGD_BUILD_XPC // Returns a Transport for macOS based on XPC. // Clangd with this transport is meant to be run as bundled XPC service. std::unique_ptr newXPCTransport(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358544 - [Driver] Simplify -g level computation and its interaction with -gsplit-dwarf
Author: maskray Date: Tue Apr 16 18:46:27 2019 New Revision: 358544 URL: http://llvm.org/viewvc/llvm-project?rev=358544&view=rev Log: [Driver] Simplify -g level computation and its interaction with -gsplit-dwarf Summary: When -gsplit-dwarf is used together with other -g options, in most cases the computed debug info level is decided by the last -g option, with one special case (see below). This patch drops that special case and thus makes it easy to reason about: // If a lower debug level -g comes after -gsplit-dwarf, in some cases // -gsplit-dwarf is cancelled. -gsplit-dwarf -g0 => 0 -gsplit-dwarf -gline-directives-only => DebugDirectivesOnly -gsplit-dwarf -gmlt -fsplit-dwarf-inlining => 1 -gsplit-dwarf -gmlt -fno-split-dwarf-inlining => 1 + split // If -gsplit-dwarf comes after -g options, with this patch, the net // effect is 2 + split for all combinations -g0 -gsplit-dwarf => 2 + split -gline-directives-only -gsplit-dwarf => 2 + split -gmlt -gsplit-dwarf -fsplit-dwarf-inlining => 2 + split -gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 + split (before) 2 + split (after) The last case has been changed. In general, if the user intends to lower debug info level, place that -g option after -gsplit-dwarf. Some context: In gcc, the last of -gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-* ... decides the debug info level (-gsplit-dwarf -gdwarf-* have level 2). It is a bit unfortunate that -gsplit-dwarf -gdwarf-* ... participate in the level computation but that is the status quo. Reviewers: dblaikie, echristo, probinson Reviewed By: dblaikie, probinson Subscribers: probinson, aprantl, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59923 Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/split-debug.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=358544&r1=358543&r2=358544&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue Apr 16 18:46:27 2019 @@ -3170,35 +3170,24 @@ static void RenderDebugOptions(const Too SplitDWARFInlining = false; } - if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) { -if (checkDebugInfoOption(A, Args, D, TC)) { - // If the last option explicitly specified a debug-info level, use it. - if (A->getOption().matches(options::OPT_gN_Group)) { -DebugInfoKind = DebugLevelToInfoKind(*A); -// If you say "-gsplit-dwarf -gline-tables-only", -gsplit-dwarf loses. -// But -gsplit-dwarf is not a g_group option, hence we have to check the -// order explicitly. If -gsplit-dwarf wins, we fix DebugInfoKind later. -// This gets a bit more complicated if you've disabled inline info in -// the skeleton CUs (SplitDWARFInlining) - then there's value in -// composing split-dwarf and line-tables-only, so let those compose -// naturally in that case. And if you just turned off debug info, -// (-gsplit-dwarf -g0) - do that. -if (DwarfFission != DwarfFissionKind::None) { - if (A->getIndex() > SplitDWARFArg->getIndex()) { -if (DebugInfoKind == codegenoptions::NoDebugInfo || -DebugInfoKind == codegenoptions::DebugDirectivesOnly || -(DebugInfoKind == codegenoptions::DebugLineTablesOnly && - SplitDWARFInlining)) - DwarfFission = DwarfFissionKind::None; - } else if (SplitDWARFInlining) -DebugInfoKind = codegenoptions::NoDebugInfo; -} - } else { -// For any other 'g' option, use Limited. -DebugInfoKind = codegenoptions::LimitedDebugInfo; - } -} else { - DebugInfoKind = codegenoptions::LimitedDebugInfo; + if (const Arg *A = + Args.getLastArg(options::OPT_g_Group, options::OPT_gsplit_dwarf, + options::OPT_gsplit_dwarf_EQ)) { +DebugInfoKind = codegenoptions::LimitedDebugInfo; + +// If the last option explicitly specified a debug-info level, use it. +if (checkDebugInfoOption(A, Args, D, TC) && +A->getOption().matches(options::OPT_gN_Group)) { + DebugInfoKind = DebugLevelToInfoKind(*A); + // For -g0 or -gline-tables-only, drop -gsplit-dwarf. This gets a bit more + // complicated if you've disabled inline info in the skeleton CUs + // (SplitDWARFInlining) - then there's value in composing split-dwarf and + // line-tables-only, so let those compose naturally in that case. + if (DebugInfoKind == codegenoptions::NoDebugInfo || + DebugInfoKind == codegenoptions::DebugDirectivesOnly || + (DebugInfoKind == codegenoptions::DebugLineTablesOnly && + SplitDWARFInlining)) +DwarfFission = DwarfFissionKind::None; } } @@ -3273,16 +3262
r358661 - [Sema] Delete unused parameters/variables
Author: maskray Date: Thu Apr 18 05:35:02 2019 New Revision: 358661 URL: http://llvm.org/viewvc/llvm-project?rev=358661&view=rev Log: [Sema] Delete unused parameters/variables Modified: cfe/trunk/lib/Sema/SemaDecl.cpp Modified: cfe/trunk/lib/Sema/SemaDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=358661&r1=358660&r2=358661&view=diff == --- cfe/trunk/lib/Sema/SemaDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Apr 18 05:35:02 2019 @@ -9612,9 +9612,7 @@ static bool CheckMultiVersionAdditionalR /// Returns true if there was an error, false otherwise. static bool CheckMultiVersionFirstFunction(Sema &S, FunctionDecl *FD, MultiVersionKind MVType, - const TargetAttr *TA, - const CPUDispatchAttr *CPUDisp, - const CPUSpecificAttr *CPUSpec) { + const TargetAttr *TA) { assert(MVType != MultiVersionKind::None && "Function lacks multiversion attribute"); @@ -9921,8 +9919,7 @@ static bool CheckMultiVersionFunction(Se // multiversioning, this isn't an error condition. if (MVType == MultiVersionKind::None) return false; -return CheckMultiVersionFirstFunction(S, NewFD, MVType, NewTA, NewCPUDisp, - NewCPUSpec); +return CheckMultiVersionFirstFunction(S, NewFD, MVType, NewTA); } FunctionDecl *OldFD = OldDecl->getAsFunction(); @@ -11777,7 +11774,6 @@ Sema::ActOnCXXForRangeIdentifier(Scope * D.SetIdentifier(Ident, IdentLoc); D.takeAttributes(Attrs, AttrEnd); - ParsedAttributes EmptyAttrs(Attrs.getPool().getFactory()); D.AddTypeInfo(DeclaratorChunk::getReference(0, IdentLoc, /*lvalue*/ false), IdentLoc); Decl *Var = ActOnDeclarator(S, D); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358729 - [analyzer] Fix -Wunused-local-typedef after rC358695
Author: maskray Date: Thu Apr 18 18:54:36 2019 New Revision: 358729 URL: http://llvm.org/viewvc/llvm-project?rev=358729&view=rev Log: [analyzer] Fix -Wunused-local-typedef after rC358695 Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp?rev=358729&r1=358728&r2=358729&view=diff == --- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp (original) +++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp Thu Apr 18 18:54:36 2019 @@ -63,11 +63,8 @@ static "In order to efficiently gather checkers/packages, this function " "expects them to be already sorted!"); - typename CheckerOrPackageInfoList::value_type Info(FullName); - - return llvm::lower_bound( - Collection, Info, - FullNameLT{}); + return llvm::lower_bound(Collection, CheckerOrPackage(FullName), + CheckerOrPackageFullNameLT{}); } static constexpr char PackageSeparator = '.'; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r358866 - [clangd] Support dependent bases in type hierarchy
Author: maskray Date: Sun Apr 21 18:38:53 2019 New Revision: 358866 URL: http://llvm.org/viewvc/llvm-project?rev=358866&view=rev Log: [clangd] Support dependent bases in type hierarchy Patch by Nathan Ridge! Dependent bases are handled heuristically, by replacing them with the class template that they are a specialization of, where possible. Care is taken to avoid infinite recursion. Differential Revision: https://reviews.llvm.org/D59756 Modified: clang-tools-extra/trunk/clangd/XRefs.cpp clang-tools-extra/trunk/unittests/clangd/TypeHierarchyTests.cpp Modified: clang-tools-extra/trunk/clangd/XRefs.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/XRefs.cpp?rev=358866&r1=358865&r2=358866&view=diff == --- clang-tools-extra/trunk/clangd/XRefs.cpp (original) +++ clang-tools-extra/trunk/clangd/XRefs.cpp Sun Apr 21 18:38:53 2019 @@ -876,21 +876,40 @@ declToTypeHierarchyItem(ASTContext &Ctx, return THI; } -static Optional getTypeAncestors(const CXXRecordDecl &CXXRD, -ASTContext &ASTCtx) { +using RecursionProtectionSet = llvm::SmallSet; + +static Optional +getTypeAncestors(const CXXRecordDecl &CXXRD, ASTContext &ASTCtx, + RecursionProtectionSet &RPSet) { Optional Result = declToTypeHierarchyItem(ASTCtx, CXXRD); if (!Result) return Result; Result->parents.emplace(); + // typeParents() will replace dependent template specializations + // with their class template, so to avoid infinite recursion for + // certain types of hierarchies, keep the templates encountered + // along the parent chain in a set, and stop the recursion if one + // starts to repeat. + auto *Pattern = CXXRD.getDescribedTemplate() ? &CXXRD : nullptr; + if (Pattern) { +if (!RPSet.insert(Pattern).second) { + return Result; +} + } + for (const CXXRecordDecl *ParentDecl : typeParents(&CXXRD)) { if (Optional ParentSym = -getTypeAncestors(*ParentDecl, ASTCtx)) { +getTypeAncestors(*ParentDecl, ASTCtx, RPSet)) { Result->parents->emplace_back(std::move(*ParentSym)); } } + if (Pattern) { +RPSet.erase(Pattern); + } + return Result; } @@ -933,10 +952,17 @@ std::vector typeP ParentDecl = RT->getAsCXXRecordDecl(); } -// For now, do not handle dependent bases such as "Base". -// We would like to handle them by heuristically choosing the -// primary template declaration, but we need to take care to -// avoid infinite recursion. +if (!ParentDecl) { + // Handle a dependent base such as "Base" by using the primary + // template. + if (const TemplateSpecializationType *TS = + Type->getAs()) { +TemplateName TN = TS->getTemplateName(); +if (TemplateDecl *TD = TN.getAsTemplateDecl()) { + ParentDecl = dyn_cast(TD->getTemplatedDecl()); +} + } +} if (ParentDecl) Result.push_back(ParentDecl); @@ -952,10 +978,13 @@ getTypeHierarchy(ParsedAST &AST, Positio if (!CXXRD) return llvm::None; + RecursionProtectionSet RPSet; Optional Result = - getTypeAncestors(*CXXRD, AST.getASTContext()); + getTypeAncestors(*CXXRD, AST.getASTContext(), RPSet); + // FIXME(nridge): Resolve type descendants if direction is Children or Both, // and ResolveLevels > 0. + return Result; } Modified: clang-tools-extra/trunk/unittests/clangd/TypeHierarchyTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/TypeHierarchyTests.cpp?rev=358866&r1=358865&r2=358866&view=diff == --- clang-tools-extra/trunk/unittests/clangd/TypeHierarchyTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/TypeHierarchyTests.cpp Sun Apr 21 18:38:53 2019 @@ -291,9 +291,7 @@ struct Child : Parent {}; EXPECT_THAT(typeParents(ChildSpec), ElementsAre(Parent)); } -// This is disabled for now, because support for dependent bases -// requires additional measures to avoid infinite recursion. -TEST(DISABLED_TypeParents, DependentBase) { +TEST(TypeParents, DependentBase) { Annotations Source(R"cpp( template struct Parent {}; @@ -383,10 +381,10 @@ int main() { } } -TEST(TypeHierarchy, RecursiveHierarchy1) { +TEST(TypeHierarchy, RecursiveHierarchyUnbounded) { Annotations Source(R"cpp( template - struct S : S {}; + struct $SDef[[S]] : S {}; S^<0> s; )cpp"); @@ -399,62 +397,57 @@ TEST(TypeHierarchy, RecursiveHierarchy1) ASSERT_TRUE(!AST.getDiagnostics().empty()); // Make sure getTypeHierarchy() doesn't get into an infinite recursion. + // FIXME(nridge): It would be preferable if the type hierarchy gave us type + // names (e.g. "S<0>" for the child and "S<1>" for the parent) rather than + // template names (e.g. "S"). llvm::Optional Resu
r358953 - [PowerPC] Fix test with -fno-discard-value-names after rC358949
Author: maskray Date: Tue Apr 23 00:39:23 2019 New Revision: 358953 URL: http://llvm.org/viewvc/llvm-project?rev=358953&view=rev Log: [PowerPC] Fix test with -fno-discard-value-names after rC358949 For the clang driver, -DLLVM_ENABLE_ASSERTIONS=off builds default to discard value names. Modified: cfe/trunk/test/CodeGen/ppc-mmintrin.c Modified: cfe/trunk/test/CodeGen/ppc-mmintrin.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ppc-mmintrin.c?rev=358953&r1=358952&r2=358953&view=diff == --- cfe/trunk/test/CodeGen/ppc-mmintrin.c (original) +++ cfe/trunk/test/CodeGen/ppc-mmintrin.c Tue Apr 23 00:39:23 2019 @@ -1,9 +1,9 @@ // REQUIRES: powerpc-registered-target -// RUN: %clang -S -emit-llvm -DNO_WARN_X86_INTRINSICS -mcpu=pwr8 -target powerpc64-gnu-linux %s \ -// RUN:-mllvm -disable-llvm-optzns -o - | llvm-cxxfilt | FileCheck %s --check-prefixes=CHECK,CHECK-BE -// RUN: %clang -S -emit-llvm -DNO_WARN_X86_INTRINSICS -mcpu=pwr8 -target powerpc64le-gnu-linux %s \ -// RUN:-mllvm -disable-llvm-optzns -o - | llvm-cxxfilt | FileCheck %s --check-prefixes=CHECK,CHECK-LE +// RUN: %clang -S -emit-llvm -target powerpc64-gnu-linux -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \ +// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt | FileCheck %s --check-prefixes=CHECK,CHECK-BE +// RUN: %clang -S -emit-llvm -target powerpc64le-gnu-linux -mcpu=pwr8 -DNO_WARN_X86_INTRINSICS %s \ +// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt | FileCheck %s --check-prefixes=CHECK,CHECK-LE #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r359098 - Use llvm::stable_sort
Author: maskray Date: Wed Apr 24 07:43:05 2019 New Revision: 359098 URL: http://llvm.org/viewvc/llvm-project?rev=359098&view=rev Log: Use llvm::stable_sort Modified: cfe/trunk/lib/AST/DeclObjC.cpp cfe/trunk/lib/AST/RecordLayoutBuilder.cpp cfe/trunk/lib/AST/VTableBuilder.cpp cfe/trunk/lib/Analysis/CloneDetection.cpp cfe/trunk/lib/CodeGen/CGBlocks.cpp cfe/trunk/lib/CodeGen/CGExprConstant.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp cfe/trunk/lib/CodeGen/CodeGenModule.cpp cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp cfe/trunk/lib/Format/Format.cpp cfe/trunk/lib/Format/SortJavaScriptImports.cpp cfe/trunk/lib/Format/UsingDeclarationsSorter.cpp cfe/trunk/lib/Index/CommentToXML.cpp cfe/trunk/lib/Sema/SemaCodeComplete.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/lib/Sema/SemaStmt.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/utils/TableGen/NeonEmitter.cpp Modified: cfe/trunk/lib/AST/DeclObjC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=359098&r1=359097&r2=359098&view=diff == --- cfe/trunk/lib/AST/DeclObjC.cpp (original) +++ cfe/trunk/lib/AST/DeclObjC.cpp Wed Apr 24 07:43:05 2019 @@ -1641,7 +1641,7 @@ ObjCIvarDecl *ObjCInterfaceDecl::all_dec if (!layout.empty()) { // Order synthesized ivars by their size. -std::stable_sort(layout.begin(), layout.end()); +llvm::stable_sort(layout); unsigned Ix = 0, EIx = layout.size(); if (!data().IvarList) { data().IvarList = layout[0].Ivar; Ix++; Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=359098&r1=359097&r2=359098&view=diff == --- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original) +++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed Apr 24 07:43:05 2019 @@ -3287,10 +3287,10 @@ static void DumpRecordLayout(raw_ostream } // Sort nvbases by offset. -std::stable_sort(Bases.begin(), Bases.end(), - [&](const CXXRecordDecl *L, const CXXRecordDecl *R) { - return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R); -}); +llvm::stable_sort( +Bases, [&](const CXXRecordDecl *L, const CXXRecordDecl *R) { + return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R); +}); // Dump (non-virtual) bases for (const CXXRecordDecl *Base : Bases) { Modified: cfe/trunk/lib/AST/VTableBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=359098&r1=359097&r2=359098&view=diff == --- cfe/trunk/lib/AST/VTableBuilder.cpp (original) +++ cfe/trunk/lib/AST/VTableBuilder.cpp Wed Apr 24 07:43:05 2019 @@ -3188,8 +3188,8 @@ void VFTableBuilder::dumpLayout(raw_ostr const CXXMethodDecl *MD = MethodNameAndDecl.second; ThunkInfoVectorTy ThunksVector = Thunks[MD]; - std::stable_sort(ThunksVector.begin(), ThunksVector.end(), - [](const ThunkInfo &LHS, const ThunkInfo &RHS) { + llvm::stable_sort(ThunksVector, [](const ThunkInfo &LHS, + const ThunkInfo &RHS) { // Keep different thunks with the same adjustments in the order they // were put into the vector. return std::tie(LHS.This, LHS.Return) < std::tie(RHS.This, RHS.Return); Modified: cfe/trunk/lib/Analysis/CloneDetection.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CloneDetection.cpp?rev=359098&r1=359097&r2=359098&view=diff == --- cfe/trunk/lib/Analysis/CloneDetection.cpp (original) +++ cfe/trunk/lib/Analysis/CloneDetection.cpp Wed Apr 24 07:43:05 2019 @@ -367,11 +367,7 @@ void RecursiveCloneTypeIIHashConstraint: } // Sort hash_codes in StmtsByHash. -std::stable_sort(StmtsByHash.begin(), StmtsByHash.end(), - [](std::pair LHS, -std::pair RHS) { - return LHS.first < RHS.first; - }); +llvm::stable_sort(StmtsByHash, llvm::less_first()); // Check for each StmtSequence if its successor has the same hash value. // We don't check the last StmtSequence as it has no successor. Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=359098&r1=359097&r2=359098&view=diff == --- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Apr 24 07:4
[clang-tools-extra] r359428 - [clangd] Delete config.clangd_xpc_support from test/ to unbreak check-llvm-tools
Author: maskray Date: Mon Apr 29 02:36:54 2019 New Revision: 359428 URL: http://llvm.org/viewvc/llvm-project?rev=359428&view=rev Log: [clangd] Delete config.clangd_xpc_support from test/ to unbreak check-llvm-tools D61187 didn't delete config.clangd_xpc_support from test/ CLANGD_BUILD_XPC is defined in clangd/CMakeLists.txt and not available in test/lit.site.cfg.py.in Modified: clang-tools-extra/trunk/test/lit.cfg.py clang-tools-extra/trunk/test/lit.site.cfg.py.in Modified: clang-tools-extra/trunk/test/lit.cfg.py URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.cfg.py?rev=359428&r1=359427&r2=359428&view=diff == --- clang-tools-extra/trunk/test/lit.cfg.py (original) +++ clang-tools-extra/trunk/test/lit.cfg.py Mon Apr 29 02:36:54 2019 @@ -115,10 +115,6 @@ if not platform.system() in ['Windows'] if platform.system() not in ['Windows']: config.available_features.add('ansi-escape-sequences') -# XPC support for Clangd. -if config.clangd_xpc_support: -config.available_features.add('clangd-xpc-support') - if config.clang_staticanalyzer: config.available_features.add('static-analyzer') Modified: clang-tools-extra/trunk/test/lit.site.cfg.py.in URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/lit.site.cfg.py.in?rev=359428&r1=359427&r2=359428&view=diff == --- clang-tools-extra/trunk/test/lit.site.cfg.py.in (original) +++ clang-tools-extra/trunk/test/lit.site.cfg.py.in Mon Apr 29 02:36:54 2019 @@ -11,7 +11,6 @@ config.clang_libs_dir = "@SHLIBDIR@" config.python_executable = "@PYTHON_EXECUTABLE@" config.target_triple = "@TARGET_TRIPLE@" config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@ -config.clangd_xpc_support = @CLANGD_BUILD_XPC@ # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r359662 - Change llvm-{objdump, readobj} -long-option to --long-option or well-known short options in tests. NFC
Author: maskray Date: Wed May 1 02:30:45 2019 New Revision: 359662 URL: http://llvm.org/viewvc/llvm-project?rev=359662&view=rev Log: Change llvm-{objdump,readobj} -long-option to --long-option or well-known short options in tests. NFC Modified: cfe/trunk/test/CodeGen/split-debug-filename.c cfe/trunk/test/CodeGen/split-debug-single-file.c cfe/trunk/test/CodeGen/thinlto-split-dwarf.c cfe/trunk/test/Driver/as-dwarf-cie.s cfe/trunk/test/Driver/embed-bitcode.s cfe/trunk/test/Modules/pch_container.m Modified: cfe/trunk/test/CodeGen/split-debug-filename.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/split-debug-filename.c?rev=359662&r1=359661&r2=359662&view=diff == --- cfe/trunk/test/CodeGen/split-debug-filename.c (original) +++ cfe/trunk/test/CodeGen/split-debug-filename.c Wed May 1 02:30:45 2019 @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang_cc1 -debug-info-kind=limited -split-dwarf-file foo.dwo -S -emit-llvm -o - %s | FileCheck %s // RUN: %clang_cc1 -debug-info-kind=limited -enable-split-dwarf -split-dwarf-file foo.dwo -S -emit-llvm -o - %s | FileCheck --check-prefix=VANILLA %s -// RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -enable-split-dwarf -split-dwarf-file %t.dwo -emit-obj -o - %s | llvm-objdump -section-headers - | FileCheck --check-prefix=O %s -// RUN: llvm-objdump -section-headers %t.dwo | FileCheck --check-prefix=DWO %s +// RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -enable-split-dwarf -split-dwarf-file %t.dwo -emit-obj -o - %s | llvm-readobj -S - | FileCheck --check-prefix=O %s +// RUN: llvm-readobj -S %t.dwo | FileCheck --check-prefix=DWO %s int main (void) { return 0; Modified: cfe/trunk/test/CodeGen/split-debug-single-file.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/split-debug-single-file.c?rev=359662&r1=359661&r2=359662&view=diff == --- cfe/trunk/test/CodeGen/split-debug-single-file.c (original) +++ cfe/trunk/test/CodeGen/split-debug-single-file.c Wed May 1 02:30:45 2019 @@ -3,13 +3,13 @@ // Testing to ensure -enable-split-dwarf=single allows to place .dwo sections into regular output object. // RUN: %clang_cc1 -debug-info-kind=limited -triple x86_64-unknown-linux \ // RUN: -enable-split-dwarf=single -split-dwarf-file %t.o -emit-obj -o %t.o %s -// RUN: llvm-objdump -section-headers %t.o | FileCheck --check-prefix=MODE-SINGLE %s +// RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=MODE-SINGLE %s // MODE-SINGLE: .dwo // Testing to ensure -enable-split-dwarf=split does not place .dwo sections into regular output object. // RUN: %clang_cc1 -debug-info-kind=limited -triple x86_64-unknown-linux \ // RUN: -enable-split-dwarf=split -split-dwarf-file %t.o -emit-obj -o %t.o %s -// RUN: llvm-objdump -section-headers %t.o | FileCheck --check-prefix=MODE-SPLIT %s +// RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=MODE-SPLIT %s // MODE-SPLIT-NOT: .dwo int main (void) { Modified: cfe/trunk/test/CodeGen/thinlto-split-dwarf.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/thinlto-split-dwarf.c?rev=359662&r1=359661&r2=359662&view=diff == --- cfe/trunk/test/CodeGen/thinlto-split-dwarf.c (original) +++ cfe/trunk/test/CodeGen/thinlto-split-dwarf.c Wed May 1 02:30:45 2019 @@ -12,8 +12,8 @@ // RUN: -emit-obj -fthinlto-index=%t.o.thinlto.bc \ // RUN: -o %t.native.o -split-dwarf-file %t.native.dwo -x ir %t.o -// RUN: llvm-readobj -sections %t.native.o | FileCheck --check-prefix=O %s -// RUN: llvm-readobj -sections %t.native.dwo | FileCheck --check-prefix=DWO %s +// RUN: llvm-readobj -S %t.native.o | FileCheck --check-prefix=O %s +// RUN: llvm-readobj -S %t.native.dwo | FileCheck --check-prefix=DWO %s // O-NOT: .dwo // DWO: .dwo Modified: cfe/trunk/test/Driver/as-dwarf-cie.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-dwarf-cie.s?rev=359662&r1=359661&r2=359662&view=diff == --- cfe/trunk/test/Driver/as-dwarf-cie.s (original) +++ cfe/trunk/test/Driver/as-dwarf-cie.s Wed May 1 02:30:45 2019 @@ -1,7 +1,7 @@ # REQUIRES: x86-registered-target # Test that there is a sane default CIE version. # RUN: %clang -cc1as -triple i386-apple-darwin -filetype obj %s -o %t -# RUN: llvm-objdump -dwarf=frames %t | FileCheck %s +# RUN: llvm-objdump --dwarf=frames %t | FileCheck %s # CHECK: .debug_frame contents: # CHECK: CIE # CHECK: Version: 1 Modified: cfe/trunk/test/Driver/embed-bitcode.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/embed-bitcode.s?rev=359662&r1=359661&r2=359662&view=diff
[clang-tools-extra] r359674 - [clangd] Delete an unused declaration
Author: maskray Date: Wed May 1 05:16:37 2019 New Revision: 359674 URL: http://llvm.org/viewvc/llvm-project?rev=359674&view=rev Log: [clangd] Delete an unused declaration Modified: clang-tools-extra/trunk/clangd/index/BackgroundIndexStorage.cpp Modified: clang-tools-extra/trunk/clangd/index/BackgroundIndexStorage.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/BackgroundIndexStorage.cpp?rev=359674&r1=359673&r2=359674&view=diff == --- clang-tools-extra/trunk/clangd/index/BackgroundIndexStorage.cpp (original) +++ clang-tools-extra/trunk/clangd/index/BackgroundIndexStorage.cpp Wed May 1 05:16:37 2019 @@ -137,9 +137,6 @@ public: return IndexStorage.get(); } - // Creates or fetches to storage from cache for the specified CDB. - BackgroundIndexStorage *createStorage(llvm::StringRef CDBDirectory); - private: std::unique_ptr create(llvm::StringRef CDBDirectory) { if (CDBDirectory.empty()) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r360022 - [X86] Move files to correct directories after D60552
Author: maskray Date: Mon May 6 02:24:36 2019 New Revision: 360022 URL: http://llvm.org/viewvc/llvm-project?rev=360022&view=rev Log: [X86] Move files to correct directories after D60552 Added: cfe/trunk/lib/Headers/avx512bf16intrin.h cfe/trunk/lib/Headers/avx512vlbf16intrin.h cfe/trunk/test/CodeGen/avx512bf16-builtins.c cfe/trunk/test/CodeGen/avx512vlbf16-builtins.c Added: cfe/trunk/lib/Headers/avx512bf16intrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bf16intrin.h?rev=360022&view=auto == --- cfe/trunk/lib/Headers/avx512bf16intrin.h (added) +++ cfe/trunk/lib/Headers/avx512bf16intrin.h Mon May 6 02:24:36 2019 @@ -0,0 +1,212 @@ +/*=== avx512bf16intrin.h - AVX512_BF16 intrinsics --=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===---=== + */ +#ifndef __IMMINTRIN_H +#error "Never use directly; include instead." +#endif + +#ifndef __AVX512BF16INTRIN_H +#define __AVX512BF16INTRIN_H + +typedef short __m512bh __attribute__((__vector_size__(64), __aligned__(64))); +typedef short __m256bh __attribute__((__vector_size__(32), __aligned__(32))); + +#define __DEFAULT_FN_ATTRS512 \ + __attribute__((__always_inline__, __nodebug__, __target__("avx512bf16"), \ + __min_vector_width__(512))) + +/// Convert Two Packed Single Data to One Packed BF16 Data. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VCVTNE2PS2BF16 instructions. +/// +/// \param __A +///A 512-bit vector of [16 x float]. +/// \param __B +///A 512-bit vector of [16 x float]. +/// \returns A 512-bit vector of [32 x bfloat] whose lower 256 bits come from +///convertion of src2, and higher 256 bits come from conversion of src1. +static __inline__ __m512bh __DEFAULT_FN_ATTRS512 +_mm512_cvtne2ps_pbh(__m512 __A, __m512 __B) { + return (__m512bh)__builtin_ia32_cvtne2ps2bf16_512((__v16sf) __A, +(__v16sf) __B); +} + +/// Convert Two Packed Single Data to One Packed BF16 Data. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VCVTNE2PS2BF16 instructions. +/// +/// \param __A +///A 512-bit vector of [16 x float]. +/// \param __B +///A 512-bit vector of [16 x float]. +/// \param __W +///A 512-bit vector of [32 x bfloat]. +/// \param __U +///An immediate value containing an 32-bit value specifying which element +///is choosed. 1 means __A or __B, 0 means __W. +/// \returns A 512-bit vector of [32 x bfloat] whose lower 256 bits come from +///convertion of src2, and higher 256 bits come from conversion of src1. +static __inline__ __m512bh __DEFAULT_FN_ATTRS512 +_mm512_mask_cvtne2ps_pbh(__m512bh __W, __mmask32 __U, __m512 __A, __m512 __B) { + return (__m512bh)__builtin_ia32_selectw_512((__mmask32)__U, +(__v32hi)_mm512_cvtne2ps_pbh(__A, __B), +(__v32hi)__W); +} + +/// Convert Two Packed Single Data to One Packed BF16 Data. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VCVTNE2PS2BF16 instructions. +/// +/// \param __A +///A 512-bit vector of [16 x float]. +/// \param __B +///A 512-bit vector of [16 x float]. +/// \param __U +///An immediate value containing an 32-bit value specifying which element +///is choosed. 1 means __A or __B, 0 means zero. +/// \returns A 512-bit vector of [32 x bfloat] whose lower 256 bits come from +///convertion of src2, and higher 256 bits come from conversion of src1. +static __inline__ __m512bh __DEFAULT_FN_ATTRS512 +_mm512_maskz_cvtne2ps_pbh(__mmask32 __U, __m512 __A, __m512 __B) { + return (__m512bh)__builtin_ia32_selectw_512((__mmask32)__U, +(__v32hi)_mm512_cvtne2ps_pbh(__A, __B), +(__v32hi)_mm512_setzero_si512()); +} + +/// Convert Packed Single Data to Packed BF16 Data. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VCVTNEPS2BF16 instructions. +/// +/// \param __A +///A 512-bit vector of [16 x float]. +/// \returns A 256-bit vector of [16 x bfloat] come from convertion of src +static __inline__ __m256bh __DEFAULT_FN_ATTRS512 +_mm512_cvtneps_pbh(__m512 __A) { + return (__m256bh)__builtin_ia32_cvtneps2bf16_512((__v16sf) __A); +} + +/// Convert Packed Single Data to Packed BF16 Data. +/// +/// \headerfile +/// +/// This intrinsic corresponds to the VCVTNEPS2BF16 instructions. +/// +/// \param __A +///A 512-bit vector of [16 x float]. +/// \param __W +///A 256-bit vector of [16 x bfloat]. +/// \param __U +///An immediate value containing an 16-bit value specifying which eleme
[clang-tools-extra] r342445 - [pp-trace] Remove unused using directives
Author: maskray Date: Mon Sep 17 23:57:58 2018 New Revision: 342445 URL: http://llvm.org/viewvc/llvm-project?rev=342445&view=rev Log: [pp-trace] Remove unused using directives Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp Modified: clang-tools-extra/trunk/pp-trace/PPTrace.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/pp-trace/PPTrace.cpp?rev=342445&r1=342444&r2=342445&view=diff == --- clang-tools-extra/trunk/pp-trace/PPTrace.cpp (original) +++ clang-tools-extra/trunk/pp-trace/PPTrace.cpp Mon Sep 17 23:57:58 2018 @@ -73,11 +73,8 @@ #include using namespace clang; -using namespace clang::driver; -using namespace clang::driver::options; using namespace clang::tooling; using namespace llvm; -using namespace llvm::opt; // Options: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r342825 - [Index] Fix header guard naming
Author: maskray Date: Sat Sep 22 15:49:38 2018 New Revision: 342825 URL: http://llvm.org/viewvc/llvm-project?rev=342825&view=rev Log: [Index] Fix header guard naming Modified: cfe/trunk/include/clang/Index/USRGeneration.h Modified: cfe/trunk/include/clang/Index/USRGeneration.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Index/USRGeneration.h?rev=342825&r1=342824&r2=342825&view=diff == --- cfe/trunk/include/clang/Index/USRGeneration.h (original) +++ cfe/trunk/include/clang/Index/USRGeneration.h Sat Sep 22 15:49:38 2018 @@ -90,5 +90,5 @@ bool generateUSRFragmentForModuleName(St } // namespace index } // namespace clang -#endif // LLVM_CLANG_IDE_USRGENERATION_H +#endif // LLVM_CLANG_INDEX_USRGENERATION_H ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r342831 - [Index] Report specialization bases as references when IndexImplicitInstantiation is true
Author: maskray Date: Sun Sep 23 01:23:48 2018 New Revision: 342831 URL: http://llvm.org/viewvc/llvm-project?rev=342831&view=rev Log: [Index] Report specialization bases as references when IndexImplicitInstantiation is true Summary: template struct B {}; template struct D : B {}; // `B` was not reported as a reference This patch fixes this. Reviewers: akyrtzi, arphaman, devnexen Reviewed By: devnexen Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52331 Modified: cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp cfe/trunk/test/Index/index-template-specialization.cpp Modified: cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp?rev=342831&r1=342830&r2=342831&view=diff == --- cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp (original) +++ cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp Sun Sep 23 01:23:48 2018 @@ -130,14 +130,15 @@ public: bool HandleTemplateSpecializationTypeLoc(TypeLocType TL) { if (const auto *T = TL.getTypePtr()) { if (IndexCtx.shouldIndexImplicitInstantiation()) { -if (CXXRecordDecl *RD = T->getAsCXXRecordDecl()) +if (CXXRecordDecl *RD = T->getAsCXXRecordDecl()) { IndexCtx.handleReference(RD, TL.getTemplateNameLoc(), Parent, ParentDC, SymbolRoleSet(), Relations); - } else { -if (const TemplateDecl *D = T->getTemplateName().getAsTemplateDecl()) - IndexCtx.handleReference(D, TL.getTemplateNameLoc(), - Parent, ParentDC, SymbolRoleSet(), Relations); + return true; +} } + if (const TemplateDecl *D = T->getTemplateName().getAsTemplateDecl()) +IndexCtx.handleReference(D, TL.getTemplateNameLoc(), Parent, ParentDC, + SymbolRoleSet(), Relations); } return true; } Modified: cfe/trunk/test/Index/index-template-specialization.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-template-specialization.cpp?rev=342831&r1=342830&r2=342831&view=diff == --- cfe/trunk/test/Index/index-template-specialization.cpp (original) +++ cfe/trunk/test/Index/index-template-specialization.cpp Sun Sep 23 01:23:48 2018 @@ -9,6 +9,12 @@ void g() { foo.f(0); } +template +struct B {}; + +template +struct D : B {}; + // FIXME: if c-index-test uses OrigD for symbol info, refererences below should // refer to template specialization decls. // RUN: env CINDEXTEST_INDEXIMPLICITTEMPLATEINSTANTIATIONS=1 c-index-test -index-file %s | FileCheck %s @@ -17,3 +23,7 @@ void g() { // CHECK-NEXT: [indexDeclaration]: kind: function | name: g // CHECK-NEXT: [indexEntityReference]: kind: c++-class-template | name: Foo | USR: c:@ST>1#T@Foo // CHECK-NEXT: [indexEntityReference]: kind: c++-instance-method | name: f | USR: c:@ST>1#T@Foo@F@f#t0.0# + +// CHECK: [indexDeclaration]: kind: c++-class-template | name: D +// CHECK-NEXT: : kind: c++-class-template | name: B +// CHECK-NEXT: [indexEntityReference]: kind: c++-class-template | name: B ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r342950 - Annotate LookupResult::clear() as LLVM_ATTRIBUTE_REINITIALIZES to silence bugprone-use-after-move after rC342925
Author: maskray Date: Tue Sep 25 01:07:42 2018 New Revision: 342950 URL: http://llvm.org/viewvc/llvm-project?rev=342950&view=rev Log: Annotate LookupResult::clear() as LLVM_ATTRIBUTE_REINITIALIZES to silence bugprone-use-after-move after rC342925 Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52446 Modified: cfe/trunk/include/clang/Sema/Lookup.h Modified: cfe/trunk/include/clang/Sema/Lookup.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=342950&r1=342949&r2=342950&view=diff == --- cfe/trunk/include/clang/Sema/Lookup.h (original) +++ cfe/trunk/include/clang/Sema/Lookup.h Tue Sep 25 01:07:42 2018 @@ -540,7 +540,7 @@ public: } /// Clears out any current state. - void clear() { + LLVM_ATTRIBUTE_REINITIALIZES void clear() { ResultKind = NotFound; Decls.clear(); if (Paths) deletePaths(Paths); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r343039 - [clangd] Remove unused using-declaration testing::AllOf
Author: maskray Date: Tue Sep 25 15:32:11 2018 New Revision: 343039 URL: http://llvm.org/viewvc/llvm-project?rev=343039&view=rev Log: [clangd] Remove unused using-declaration testing::AllOf Modified: clang-tools-extra/trunk/unittests/clangd/SerializationTests.cpp Modified: clang-tools-extra/trunk/unittests/clangd/SerializationTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/SerializationTests.cpp?rev=343039&r1=343038&r2=343039&view=diff == --- clang-tools-extra/trunk/unittests/clangd/SerializationTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/SerializationTests.cpp Tue Sep 25 15:32:11 2018 @@ -13,7 +13,6 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -using testing::AllOf; using testing::UnorderedElementsAre; using testing::UnorderedElementsAreArray; namespace clang { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343072 - [Frontend] Tidy up -print-decl-contexts conditions
Author: maskray Date: Tue Sep 25 23:28:14 2018 New Revision: 343072 URL: http://llvm.org/viewvc/llvm-project?rev=343072&view=rev Log: [Frontend] Tidy up -print-decl-contexts conditions The existing conditions are not consistent. Some have braces and define a temporary Decl while others simply call `<< *cast(I)` (mostly the NamedDecl overload of operator<<). Just use the latter for consistency and brevity. Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=343072&r1=343071&r2=343072&view=diff == --- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original) +++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Tue Sep 25 23:28:14 2018 @@ -442,75 +442,53 @@ void DeclContextPrinter::PrintDeclContex PrintDeclContext(DC, Indentation+2); break; } -case Decl::IndirectField: { - IndirectFieldDecl* IFD = cast(I); - Out << " " << *IFD << '\n'; +case Decl::IndirectField: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::Label: { - LabelDecl *LD = cast(I); - Out << " " << *LD << '\n'; +case Decl::Label: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::Field: { - FieldDecl *FD = cast(I); - Out << " " << *FD << '\n'; +case Decl::Field: + Out << " " << *cast(I) << '\n'; break; -} case Decl::Typedef: -case Decl::TypeAlias: { - TypedefNameDecl* TD = cast(I); - Out << " " << *TD << '\n'; +case Decl::TypeAlias: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::EnumConstant: { - EnumConstantDecl* ECD = cast(I); - Out << " " << *ECD << '\n'; +case Decl::EnumConstant: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::Var: { - VarDecl* VD = cast(I); - Out << " " << *VD << '\n'; +case Decl::Var: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::ImplicitParam: { - ImplicitParamDecl* IPD = cast(I); - Out << " " << *IPD << '\n'; +case Decl::ImplicitParam: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::ParmVar: { - ParmVarDecl* PVD = cast(I); - Out << " " << *PVD << '\n'; +case Decl::ParmVar: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::ObjCProperty: { - ObjCPropertyDecl* OPD = cast(I); - Out << " " << *OPD << '\n'; +case Decl::ObjCProperty: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::FunctionTemplate: { - FunctionTemplateDecl* FTD = cast(I); - Out << " " << *FTD << '\n'; +case Decl::FunctionTemplate: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::FileScopeAsm: { +case Decl::TypeAliasTemplate: + Out << " " << *cast(I) + << '\n'; + break; +case Decl::FileScopeAsm: Out << "\n"; break; -} -case Decl::UsingDirective: { +case Decl::UsingDirective: Out << "\n"; break; -} -case Decl::NamespaceAlias: { - NamespaceAliasDecl* NAD = cast(I); - Out << " " << *NAD << '\n'; +case Decl::NamespaceAlias: + Out << " " << *cast(I) << '\n'; break; -} -case Decl::ClassTemplate: { - ClassTemplateDecl *CTD = cast(I); - Out << " " << *CTD << '\n'; +case Decl::ClassTemplate: + Out << " " << *cast(I) << '\n'; break; -} case Decl::OMPThreadPrivate: { Out << " " << '"' << I << "\"\n"; break; @@ -522,30 +500,29 @@ void DeclContextPrinter::PrintDeclContex Out << "\n"; break; } -case Decl::Using: { +case Decl::Using: Out << " " << *cast(I) << "\n"; break; -} -case Decl::UsingShadow: { +case Decl::UsingShadow: Out << " " << *cast(I) << "\n"; break; -} -case Decl::Empty: { +case Decl::UnresolvedUsingValue: + Out << " " << *cast(I) + << "\n"; + break; +case Decl::Empty: Out << "\n"; break; -} -case Decl::AccessSpec: { +case Decl::AccessSpec: Out << "\n"; break; -} -case Decl::VarTemplate: { +case Decl::VarTemplate: Out << " " << *cast(I) << "\n"; break; -} -case Decl::StaticAssert: { +case Decl::StaticAssert: Out << "\n"; break; -} + default: Out << "DeclKind: " << DK << '"' << I << "\"\n"; llvm_unreachable("decl unhandled"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343147 - llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Author: maskray Date: Wed Sep 26 15:16:28 2018 New Revision: 343147 URL: http://llvm.org/viewvc/llvm-project?rev=343147&view=rev Log: llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...) Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: rsmith, #clang, dblaikie Reviewed By: rsmith, #clang Subscribers: mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52576 Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/lib/AST/VTableBuilder.cpp cfe/trunk/lib/Analysis/LiveVariables.cpp cfe/trunk/lib/Basic/VirtualFileSystem.cpp cfe/trunk/lib/CodeGen/CGBlocks.cpp cfe/trunk/lib/CodeGen/CGObjCGNU.cpp cfe/trunk/lib/CodeGen/CGVTables.cpp cfe/trunk/lib/CodeGen/CodeGenModule.cpp cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/Driver/XRayArgs.cpp cfe/trunk/lib/Format/FormatTokenLexer.cpp cfe/trunk/lib/Format/WhitespaceManager.cpp cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp cfe/trunk/lib/Sema/SemaDeclAttr.cpp cfe/trunk/lib/Sema/SemaLookup.cpp cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp cfe/trunk/lib/StaticAnalyzer/Core/CheckerRegistry.cpp cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp cfe/trunk/lib/Tooling/Core/Replacement.cpp cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp cfe/trunk/tools/diagtool/DiagTool.cpp cfe/trunk/tools/libclang/CIndex.cpp cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp cfe/trunk/utils/TableGen/ClangOptionDocEmitter.cpp cfe/trunk/utils/TableGen/NeonEmitter.cpp Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=343147&r1=343146&r2=343147&view=diff == --- cfe/trunk/lib/AST/ItaniumMangle.cpp (original) +++ cfe/trunk/lib/AST/ItaniumMangle.cpp Wed Sep 26 15:16:28 2018 @@ -323,7 +323,7 @@ class CXXNameMangler { AdditionalAbiTags->end()); } - llvm::sort(TagList.begin(), TagList.end()); + llvm::sort(TagList); TagList.erase(std::unique(TagList.begin(), TagList.end()), TagList.end()); writeSortedUniqueAbiTags(Out, TagList); @@ -339,7 +339,7 @@ class CXXNameMangler { } const AbiTagList &getSortedUniqueUsedAbiTags() { - llvm::sort(UsedAbiTags.begin(), UsedAbiTags.end()); + llvm::sort(UsedAbiTags); UsedAbiTags.erase(std::unique(UsedAbiTags.begin(), UsedAbiTags.end()), UsedAbiTags.end()); return UsedAbiTags; Modified: cfe/trunk/lib/AST/VTableBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=343147&r1=343146&r2=343147&view=diff == --- cfe/trunk/lib/AST/VTableBuilder.cpp (original) +++ cfe/trunk/lib/AST/VTableBuilder.cpp Wed Sep 26 15:16:28 2018 @@ -2105,8 +2105,7 @@ void ItaniumVTableBuilder::dumpLayout(ra const CXXMethodDecl *MD = I.second; ThunkInfoVectorTy ThunksVector = Thunks[MD]; - llvm::sort(ThunksVector.begin(), ThunksVector.end(), - [](const ThunkInfo &LHS, const ThunkInfo &RHS) { + llvm::sort(ThunksVector, [](const ThunkInfo &LHS, const ThunkInfo &RHS) { assert(LHS.Method == nullptr && RHS.Method == nullptr); return std::tie(LHS.This, LHS.Return) < std::tie(RHS.This, RHS.Return); }); @@ -3345,8 +3344,7 @@ static bool rebucketPaths(VPtrInfoVector PathsSorted.reserve(Paths.size()); for (auto& P : Paths) PathsSorted.push_back(*P); - llvm::sort(PathsSorted.begin(), PathsSorted.end(), - [](const VPtrInfo &LHS, const VPtrInfo &RHS) { + llvm::sort(PathsSorted, [](const VPtrInfo &LHS, const VPtrInfo &RHS) { return LHS.MangledPath < RHS.MangledPath; }); bool Changed = false; Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=343147&r1=343146&r2=343147&view=diff == --- cfe/trunk/lib/Analysis/LiveVariables.cpp (original) +++ cfe/trunk/lib/Analysis/LiveVariables.cpp Wed Sep 26 15:16:28 2018 @@ -597,7 +597,7 @@ void LiveVariablesImpl::dumpBlockLivenes it != ei; ++it) { vec.push_back(it->first); } - llvm::sort(vec.begin(), vec.end(), [](const CFGBlock *A, const CFGBlock *B) { + llvm::sort(vec, [](const CFGBlock *A, const CFGBlock *B) {
r343152 - Remove trailing space in rC343150
Author: maskray Date: Wed Sep 26 16:47:00 2018 New Revision: 343152 URL: http://llvm.org/viewvc/llvm-project?rev=343152&view=rev Log: Remove trailing space in rC343150 Modified: cfe/trunk/include/clang/Sema/Lookup.h Modified: cfe/trunk/include/clang/Sema/Lookup.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=343152&r1=343151&r2=343152&view=diff == --- cfe/trunk/include/clang/Sema/Lookup.h (original) +++ cfe/trunk/include/clang/Sema/Lookup.h Wed Sep 26 16:47:00 2018 @@ -711,7 +711,7 @@ private: LookupResultKind ResultKind = NotFound; // ill-defined unless ambiguous. Still need to be initialized it will be // copied/moved. - AmbiguityKind Ambiguity = {}; + AmbiguityKind Ambiguity = {}; UnresolvedSet<8> Decls; CXXBasePaths *Paths = nullptr; CXXRecordDecl *NamingClass = nullptr; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r343166 - llvm::sort(C.begin(), C.end()) -> llvm::sort(C)
Author: maskray Date: Wed Sep 26 21:19:29 2018 New Revision: 343166 URL: http://llvm.org/viewvc/llvm-project?rev=343166&view=rev Log: llvm::sort(C.begin(), C.end()) -> llvm::sort(C) The convenience wrapper in STLExtras is available since rL342102. Modified: clang-tools-extra/trunk/clang-tidy/readability/MagicNumbersCheck.cpp Modified: clang-tools-extra/trunk/clang-tidy/readability/MagicNumbersCheck.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/MagicNumbersCheck.cpp?rev=343166&r1=343165&r2=343166&view=diff == --- clang-tools-extra/trunk/clang-tidy/readability/MagicNumbersCheck.cpp (original) +++ clang-tools-extra/trunk/clang-tidy/readability/MagicNumbersCheck.cpp Wed Sep 26 21:19:29 2018 @@ -66,7 +66,7 @@ MagicNumbersCheck::MagicNumbersCheck(Str IgnoredIntegerValues.resize(IgnoredIntegerValuesInput.size()); llvm::transform(IgnoredIntegerValuesInput, IgnoredIntegerValues.begin(), [](const std::string &Value) { return std::stoll(Value); }); - llvm::sort(IgnoredIntegerValues.begin(), IgnoredIntegerValues.end()); + llvm::sort(IgnoredIntegerValues); if (!IgnoreAllFloatingPointValues) { // Process the set of ignored floating point values. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r343168 - [clang-tidy] Add dependency to clangAnalysis after rC343160
Author: maskray Date: Wed Sep 26 21:23:24 2018 New Revision: 343168 URL: http://llvm.org/viewvc/llvm-project?rev=343168&view=rev Log: [clang-tidy] Add dependency to clangAnalysis after rC343160 Modified: clang-tools-extra/trunk/clang-tidy/mpi/CMakeLists.txt Modified: clang-tools-extra/trunk/clang-tidy/mpi/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/mpi/CMakeLists.txt?rev=343168&r1=343167&r2=343168&view=diff == --- clang-tools-extra/trunk/clang-tidy/mpi/CMakeLists.txt (original) +++ clang-tools-extra/trunk/clang-tidy/mpi/CMakeLists.txt Wed Sep 26 21:23:24 2018 @@ -6,6 +6,7 @@ add_clang_library(clangTidyMPIModule TypeMismatchCheck.cpp LINK_LIBS + clangAnalysis clangAST clangASTMatchers clangBasic ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343425 - Use the container form llvm::sort(C, ...)
Author: maskray Date: Sun Sep 30 14:41:11 2018 New Revision: 343425 URL: http://llvm.org/viewvc/llvm-project?rev=343425&view=rev Log: Use the container form llvm::sort(C, ...) There are a few leftovers of rC343147 that are not (\w+)\.begin but in the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them to use the container form in this commit. The 12 occurrences have been inspected manually for safety. Modified: cfe/trunk/include/clang/Serialization/ContinuousRangeMap.h cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/AST/VTableBuilder.cpp cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp cfe/trunk/lib/Basic/Targets.cpp cfe/trunk/lib/CodeGen/CodeGenModule.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Modified: cfe/trunk/include/clang/Serialization/ContinuousRangeMap.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ContinuousRangeMap.h?rev=343425&r1=343424&r2=343425&view=diff == --- cfe/trunk/include/clang/Serialization/ContinuousRangeMap.h (original) +++ cfe/trunk/include/clang/Serialization/ContinuousRangeMap.h Sun Sep 30 14:41:11 2018 @@ -118,7 +118,7 @@ public: Builder &operator=(const Builder&) = delete; ~Builder() { - llvm::sort(Self.Rep.begin(), Self.Rep.end(), Compare()); + llvm::sort(Self.Rep, Compare()); std::unique(Self.Rep.begin(), Self.Rep.end(), [](const_reference A, const_reference B) { // FIXME: we should not allow any duplicate keys, but there are a lot of Modified: cfe/trunk/lib/AST/ASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=343425&r1=343424&r2=343425&view=diff == --- cfe/trunk/lib/AST/ASTContext.cpp (original) +++ cfe/trunk/lib/AST/ASTContext.cpp Sun Sep 30 14:41:11 2018 @@ -2295,12 +2295,11 @@ structHasUniqueObjectRepresentations(con } } -llvm::sort( -Bases.begin(), Bases.end(), [&](const std::pair &L, -const std::pair &R) { - return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) < - Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl()); -}); +llvm::sort(Bases, [&](const std::pair &L, + const std::pair &R) { + return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) < + Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl()); +}); for (const auto Base : Bases) { int64_t BaseOffset = Context.toBits( Modified: cfe/trunk/lib/AST/VTableBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=343425&r1=343424&r2=343425&view=diff == --- cfe/trunk/lib/AST/VTableBuilder.cpp (original) +++ cfe/trunk/lib/AST/VTableBuilder.cpp Sun Sep 30 14:41:11 2018 @@ -2205,13 +2205,12 @@ VTableLayout::VTableLayout(ArrayRefVTableIndices = OwningArrayRef(VTableIndices); - llvm::sort(this->VTableThunks.begin(), this->VTableThunks.end(), - [](const VTableLayout::VTableThunkTy &LHS, -const VTableLayout::VTableThunkTy &RHS) { - assert((LHS.first != RHS.first || LHS.second == RHS.second) && - "Different thunks should have unique indices!"); - return LHS.first < RHS.first; -}); + llvm::sort(this->VTableThunks, [](const VTableLayout::VTableThunkTy &LHS, +const VTableLayout::VTableThunkTy &RHS) { +assert((LHS.first != RHS.first || LHS.second == RHS.second) && + "Different thunks should have unique indices!"); +return LHS.first < RHS.first; + }); } VTableLayout::~VTableLayout() { } Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp?rev=343425&r1=343424&r2=343425&view=diff == --- cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp (original) +++ cfe/trunk/lib/ASTMatchers/Dynamic/Parser.cpp Sun Sep 30 14:41:11 2018 @@ -645,12 +645,12 @@ Parser::completeExpression(StringRef Cod P.parseExpressionImpl(&Dummy); // Sort by specificity, then by name. - llvm::sort(P.Completions.begin(), P.Completions.end(), + llvm::sort(P.Completions, [](const MatcherCompletion &A, const MatcherCompletion &B) { -if (A.Specificity != B.Specificity) - return A.Specificity > B.Specificity; -return A.TypedText < B.TypedText; - }); + if (A.Specificity != B.Specificity) + return A.Specificity > B.Specificity; +
r343660 - [Frontend] Delete -print-decl-contexts
Author: maskray Date: Tue Oct 2 20:50:44 2018 New Revision: 343660 URL: http://llvm.org/viewvc/llvm-project?rev=343660&view=rev Log: [Frontend] Delete -print-decl-contexts Summary: Its job is covered by -ast-dump. The option is rarely used and lacks many AST nodes which will lead to llvm_unreachable() crash. Reviewers: rsmith, arphaman Reviewed By: rsmith Subscribers: jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D52529 Modified: cfe/trunk/include/clang/Driver/CC1Options.td cfe/trunk/include/clang/Frontend/ASTConsumers.h cfe/trunk/include/clang/Frontend/FrontendOptions.h cfe/trunk/lib/Frontend/ASTConsumers.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/FrontendActions.cpp cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp cfe/trunk/test/Coverage/ast-printing.c cfe/trunk/test/Coverage/ast-printing.cpp Modified: cfe/trunk/include/clang/Driver/CC1Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=343660&r1=343659&r2=343660&view=diff == --- cfe/trunk/include/clang/Driver/CC1Options.td (original) +++ cfe/trunk/include/clang/Driver/CC1Options.td Tue Oct 2 20:50:44 2018 @@ -540,8 +540,6 @@ def ast_dump_lookups : Flag<["-"], "ast- HelpText<"Build ASTs and then debug dump their name lookup tables">; def ast_view : Flag<["-"], "ast-view">, HelpText<"Build ASTs and view them with GraphViz">; -def print_decl_contexts : Flag<["-"], "print-decl-contexts">, - HelpText<"Print DeclContexts and their Decls">; def emit_module : Flag<["-"], "emit-module">, HelpText<"Generate pre-compiled module file from a module map">; def emit_module_interface : Flag<["-"], "emit-module-interface">, Modified: cfe/trunk/include/clang/Frontend/ASTConsumers.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTConsumers.h?rev=343660&r1=343659&r2=343660&view=diff == --- cfe/trunk/include/clang/Frontend/ASTConsumers.h (original) +++ cfe/trunk/include/clang/Frontend/ASTConsumers.h Tue Oct 2 20:50:44 2018 @@ -50,10 +50,6 @@ std::unique_ptr CreateASTDe // function declarations to stderr. std::unique_ptr CreateASTViewer(); -// DeclContext printer: prints out the DeclContext tree in human-readable form -// to stderr; this is intended for debugging. -std::unique_ptr CreateDeclContextPrinter(); - } // end clang namespace #endif Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=343660&r1=343659&r2=343660&view=diff == --- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original) +++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Tue Oct 2 20:50:44 2018 @@ -106,9 +106,6 @@ enum ActionKind { /// Run a plugin action, \see ActionName. PluginAction, - /// Print DeclContext and their Decls. - PrintDeclContext, - /// Print the "preamble" of the input file PrintPreamble, Modified: cfe/trunk/lib/Frontend/ASTConsumers.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTConsumers.cpp?rev=343660&r1=343659&r2=343660&view=diff == --- cfe/trunk/lib/Frontend/ASTConsumers.cpp (original) +++ cfe/trunk/lib/Frontend/ASTConsumers.cpp Tue Oct 2 20:50:44 2018 @@ -193,342 +193,3 @@ void ASTViewer::HandleTopLevelSingleDecl std::unique_ptr clang::CreateASTViewer() { return llvm::make_unique(); } - -//===--===// -/// DeclContextPrinter - Decl and DeclContext Visualization - -namespace { - -class DeclContextPrinter : public ASTConsumer { - raw_ostream& Out; -public: - DeclContextPrinter() : Out(llvm::errs()) {} - - void HandleTranslationUnit(ASTContext &C) override { -PrintDeclContext(C.getTranslationUnitDecl(), 4); - } - - void PrintDeclContext(const DeclContext* DC, unsigned Indentation); -}; -} // end anonymous namespace - -void DeclContextPrinter::PrintDeclContext(const DeclContext* DC, - unsigned Indentation) { - // Print DeclContext name. - switch (DC->getDeclKind()) { - case Decl::TranslationUnit: -Out << "[translation unit] " << DC; -break; - case Decl::Namespace: { -Out << "[namespace] "; -const NamespaceDecl* ND = cast(DC); -Out << *ND; -break; - } - case Decl::Enum: { -const EnumDecl* ED = cast(DC); -if (ED->isCompleteDefinition()) - Out << "[enum] "; -else - Out << " "; -Out << *ED; -break; - } - case Decl::Record: { -const RecordDecl* RD = cast(DC); -if (RD->isCompleteDefinition()) - Out << "[struct] "; -else - Out <<
r343721 - [test] Fix -Wunused-variable in rC343665
Author: maskray Date: Wed Oct 3 13:53:53 2018 New Revision: 343721 URL: http://llvm.org/viewvc/llvm-project?rev=343721&view=rev Log: [test] Fix -Wunused-variable in rC343665 Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp?rev=343721&r1=343720&r2=343721&view=diff == --- cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp (original) +++ cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp Wed Oct 3 13:53:53 2018 @@ -183,7 +183,7 @@ TEST(ParserTest, ParseMatcher) { TEST(ParserTest, ParseComment) { MockSema Sema; - const uint64_t ExpectedFoo = Sema.expectMatcher("Foo"); + Sema.expectMatcher("Foo"); Sema.parse(" Foo() # Bar() "); for (const auto &E : Sema.Errors) { EXPECT_EQ("", E); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343722 - [ASTMatchers] Fix DynamicASTMatchersTests again
Author: maskray Date: Wed Oct 3 14:00:44 2018 New Revision: 343722 URL: http://llvm.org/viewvc/llvm-project?rev=343722&view=rev Log: [ASTMatchers] Fix DynamicASTMatchersTests again Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp?rev=343722&r1=343721&r2=343722&view=diff == --- cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp (original) +++ cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp Wed Oct 3 14:00:44 2018 @@ -183,7 +183,6 @@ TEST(ParserTest, ParseMatcher) { TEST(ParserTest, ParseComment) { MockSema Sema; - Sema.expectMatcher("Foo"); Sema.parse(" Foo() # Bar() "); for (const auto &E : Sema.Errors) { EXPECT_EQ("", E); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343738 - Revert "[ASTMatchers] Fix DynamicASTMatchersTests again"
Author: maskray Date: Wed Oct 3 15:56:26 2018 New Revision: 343738 URL: http://llvm.org/viewvc/llvm-project?rev=343738&view=rev Log: Revert "[ASTMatchers] Fix DynamicASTMatchersTests again" This reverts commit 8a6631a983ec9c1d22cc77c5f55a524a651740f0. The last fix seems good in Debug mode. Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp?rev=343738&r1=343737&r2=343738&view=diff == --- cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp (original) +++ cfe/trunk/unittests/ASTMatchers/Dynamic/ParserTest.cpp Wed Oct 3 15:56:26 2018 @@ -183,6 +183,7 @@ TEST(ParserTest, ParseMatcher) { TEST(ParserTest, ParseComment) { MockSema Sema; + Sema.expectMatcher("Foo"); Sema.parse(" Foo() # Bar() "); for (const auto &E : Sema.Errors) { EXPECT_EQ("", E); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r343912 - [clangd] Remove unused headers from CodeComplete.cpp
Author: maskray Date: Sat Oct 6 00:00:50 2018 New Revision: 343912 URL: http://llvm.org/viewvc/llvm-project?rev=343912&view=rev Log: [clangd] Remove unused headers from CodeComplete.cpp queue is not used after index-provided completions' merge with those from Sema USRGeneration.h is not used after introduction of getSymbolID Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=343912&r1=343911&r2=343912&view=diff == --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Sat Oct 6 00:00:50 2018 @@ -40,11 +40,9 @@ #include "clang/Format/Format.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendActions.h" -#include "clang/Index/USRGeneration.h" #include "clang/Lex/PreprocessorOptions.h" #include "clang/Sema/CodeCompleteConsumer.h" #include "clang/Sema/Sema.h" -#include "clang/Tooling/Core/Replacement.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" @@ -54,7 +52,6 @@ #include "llvm/Support/ScopedPrinter.h" #include #include -#include // We log detailed candidate here if you run with -debug-only=codecomplete. #define DEBUG_TYPE "CodeComplete" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r343946 - [clangd] Migrate to LLVM STLExtras range API
Author: maskray Date: Sun Oct 7 10:21:08 2018 New Revision: 343946 URL: http://llvm.org/viewvc/llvm-project?rev=343946&view=rev Log: [clangd] Migrate to LLVM STLExtras range API Modified: clang-tools-extra/trunk/clangd/FileDistance.cpp clang-tools-extra/trunk/clangd/XRefs.cpp Modified: clang-tools-extra/trunk/clangd/FileDistance.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FileDistance.cpp?rev=343946&r1=343945&r2=343946&view=diff == --- clang-tools-extra/trunk/clangd/FileDistance.cpp (original) +++ clang-tools-extra/trunk/clangd/FileDistance.cpp Sun Oct 7 10:21:08 2018 @@ -72,8 +72,8 @@ FileDistance::FileDistance(StringMap S.getValue().MaxUpTraversals) { if (Cache.find(Hash) != Cache.end()) Modified: clang-tools-extra/trunk/clangd/XRefs.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/XRefs.cpp?rev=343946&r1=343945&r2=343946&view=diff == --- clang-tools-extra/trunk/clangd/XRefs.cpp (original) +++ clang-tools-extra/trunk/clangd/XRefs.cpp Sun Oct 7 10:21:08 2018 @@ -372,11 +372,10 @@ public: } std::vector take() && { -std::sort(References.begin(), References.end(), - [](const Reference &L, const Reference &R) { -return std::tie(L.Loc, L.CanonicalTarget, L.Role) < - std::tie(R.Loc, R.CanonicalTarget, R.Role); - }); +llvm::sort(References, [](const Reference &L, const Reference &R) { + return std::tie(L.Loc, L.CanonicalTarget, L.Role) < + std::tie(R.Loc, R.CanonicalTarget, R.Role); +}); // We sometimes see duplicates when parts of the AST get traversed twice. References.erase( std::unique(References.begin(), References.end(), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344010 - [Index] Use locations to uniquify function-scope BindingDecl USR
Author: maskray Date: Mon Oct 8 18:02:56 2018 New Revision: 344010 URL: http://llvm.org/viewvc/llvm-project?rev=344010&view=rev Log: [Index] Use locations to uniquify function-scope BindingDecl USR Summary: This makes BindingDecl's of the same name have different USRs, so that references can be correctly attributed. int a[1] = {}; { auto [x] = a; x; } { auto [x] = a; x; } Reviewers: akyrtzi, arphaman, rsmith, hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52445 Modified: cfe/trunk/lib/Index/USRGeneration.cpp cfe/trunk/test/Index/Core/index-source.cpp Modified: cfe/trunk/lib/Index/USRGeneration.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/USRGeneration.cpp?rev=344010&r1=344009&r2=344010&view=diff == --- cfe/trunk/lib/Index/USRGeneration.cpp (original) +++ cfe/trunk/lib/Index/USRGeneration.cpp Mon Oct 8 18:02:56 2018 @@ -97,6 +97,7 @@ public: void VisitTypedefDecl(const TypedefDecl *D); void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D); void VisitVarDecl(const VarDecl *D); + void VisitBindingDecl(const BindingDecl *D); void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D); void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D); void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D); @@ -334,6 +335,12 @@ void USRGenerator::VisitVarDecl(const Va } } +void USRGenerator::VisitBindingDecl(const BindingDecl *D) { + if (isLocal(D) && GenLoc(D, /*IncludeOffset=*/true)) +return; + VisitNamedDecl(D); +} + void USRGenerator::VisitNonTypeTemplateParmDecl( const NonTypeTemplateParmDecl *D) { GenLoc(D, /*IncludeOffset=*/true); Modified: cfe/trunk/test/Index/Core/index-source.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.cpp?rev=344010&r1=344009&r2=344010&view=diff == --- cfe/trunk/test/Index/Core/index-source.cpp (original) +++ cfe/trunk/test/Index/Core/index-source.cpp Mon Oct 8 18:02:56 2018 @@ -1,4 +1,5 @@ // RUN: c-index-test core -print-source-symbols -- %s -std=c++1z -target x86_64-apple-macosx10.7 | FileCheck %s +// RUN: c-index-test core -print-source-symbols -include-locals -- %s -std=c++1z -target x86_64-apple-macosx10.7 | FileCheck -check-prefix=LOCAL %s // CHECK: [[@LINE+1]]:7 | class/C++ | Cls | [[Cls_USR:.*]] | | Def | rel: 0 class Cls { public: @@ -493,6 +494,7 @@ void localStructuredBindingAndRef() { // CHECK: [[@LINE-1]]:69 | variable/C++ | structuredBinding2 | c:@N@cpp17structuredBinding@structuredBinding2 | | Ref,Read,RelCont | rel: 1 // CHECK-NEXT: RelCont | localStructuredBindingAndRef | c:@N@cpp17structuredBinding@F@localStructuredBindingAndRef# // CHECK-NOT: localBinding +// LOCAL: [[@LINE-4]]:9 | variable(local)/C++ | localBinding1 | c:index-source.cpp@25382@N@cpp17structuredBinding@F@localStructuredBindingAndRef#@localBinding1 } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r352872 - [libclang] Fix -DBUILD_SHARED_LIBS=on build after rC352803
Author: maskray Date: Fri Feb 1 06:31:01 2019 New Revision: 352872 URL: http://llvm.org/viewvc/llvm-project?rev=352872&view=rev Log: [libclang] Fix -DBUILD_SHARED_LIBS=on build after rC352803 Modified: cfe/trunk/tools/libclang/CMakeLists.txt Modified: cfe/trunk/tools/libclang/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=352872&r1=352871&r2=352872&view=diff == --- cfe/trunk/tools/libclang/CMakeLists.txt (original) +++ cfe/trunk/tools/libclang/CMakeLists.txt Fri Feb 1 06:31:01 2019 @@ -36,6 +36,7 @@ set(SOURCES set(LIBS clangAST clangBasic + clangDriver clangFrontend clangIndex clangLex ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r353415 - [ELF] Format lines inadvertently indented by rCTE353380
Author: maskray Date: Thu Feb 7 07:38:14 2019 New Revision: 353415 URL: http://llvm.org/viewvc/llvm-project?rev=353415&view=rev Log: [ELF] Format lines inadvertently indented by rCTE353380 Modified: clang-tools-extra/trunk/clangd/SourceCode.h Modified: clang-tools-extra/trunk/clangd/SourceCode.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/SourceCode.h?rev=353415&r1=353414&r2=353415&view=diff == --- clang-tools-extra/trunk/clangd/SourceCode.h (original) +++ clang-tools-extra/trunk/clangd/SourceCode.h Thu Feb 7 07:38:14 2019 @@ -47,7 +47,7 @@ size_t lspLength(StringRef Code); /// The returned value is in the range [0, Code.size()]. llvm::Expected positionToOffset(llvm::StringRef Code, Position P, - bool AllowColumnsBeyondLineLength = true); + bool AllowColumnsBeyondLineLength = true); /// Turn an offset in Code into a [line, column] pair. /// The offset must be in range [0, Code.size()]. @@ -110,7 +110,7 @@ Range halfOpenToRange(const SourceManage // The offset must be in range [0, Code.size()]. // Prefer to use SourceManager if one is available. std::pair offsetToClangLineColumn(llvm::StringRef Code, -size_t Offset); + size_t Offset); /// From "a::b::c", return {"a::b::", "c"}. Scope is empty if there's no /// qualifier. @@ -120,10 +120,10 @@ splitQualifiedName(llvm::StringRef QName TextEdit replacementToEdit(StringRef Code, const tooling::Replacement &R); std::vector replacementsToEdits(StringRef Code, -const tooling::Replacements &Repls); + const tooling::Replacements &Repls); TextEdit toTextEdit(const FixItHint &FixIt, const SourceManager &M, - const LangOptions &L); +const LangOptions &L); /// Get the canonical path of \p F. This means: /// @@ -136,7 +136,7 @@ TextEdit toTextEdit(const FixItHint &Fix /// component that generate it, so that paths are normalized as much as /// possible. llvm::Optional getCanonicalPath(const FileEntry *F, - const SourceManager &SourceMgr); + const SourceManager &SourceMgr); bool isRangeConsecutive(const Range &Left, const Range &Right); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r353635 - Use llvm::is_contained. NFC
Author: maskray Date: Sat Feb 9 21:54:57 2019 New Revision: 353635 URL: http://llvm.org/viewvc/llvm-project?rev=353635&view=rev Log: Use llvm::is_contained. NFC Modified: cfe/trunk/lib/ARCMigrate/ARCMT.cpp cfe/trunk/lib/AST/RecordLayoutBuilder.cpp cfe/trunk/lib/Basic/TargetInfo.cpp cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp cfe/trunk/lib/Driver/ToolChains/Arch/RISCV.cpp cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp cfe/trunk/unittests/Tooling/ToolingTest.cpp cfe/trunk/utils/TableGen/NeonEmitter.cpp Modified: cfe/trunk/lib/ARCMigrate/ARCMT.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ARCMT.cpp?rev=353635&r1=353634&r2=353635&view=diff == --- cfe/trunk/lib/ARCMigrate/ARCMT.cpp (original) +++ cfe/trunk/lib/ARCMigrate/ARCMT.cpp Sat Feb 9 21:54:57 2019 @@ -35,10 +35,10 @@ bool CapturedDiagList::clearDiagnostic(A while (I != List.end()) { FullSourceLoc diagLoc = I->getLocation(); if ((IDs.empty() || // empty means clear all diagnostics in the range. - std::find(IDs.begin(), IDs.end(), I->getID()) != IDs.end()) && + llvm::is_contained(IDs, I->getID())) && !diagLoc.isBeforeInTranslationUnitThan(range.getBegin()) && (diagLoc == range.getEnd() || - diagLoc.isBeforeInTranslationUnitThan(range.getEnd( { + diagLoc.isBeforeInTranslationUnitThan(range.getEnd( { cleared = true; ListTy::iterator eraseS = I++; if (eraseS->getLevel() != DiagnosticsEngine::Note) Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=353635&r1=353634&r2=353635&view=diff == --- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original) +++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Sat Feb 9 21:54:57 2019 @@ -254,7 +254,7 @@ void EmptySubobjectMap::AddSubobjectAtOf // If we have empty structures inside a union, we can assign both // the same offset. Just avoid pushing them twice in the list. ClassVectorTy &Classes = EmptyClassOffsets[Offset]; - if (std::find(Classes.begin(), Classes.end(), RD) != Classes.end()) + if (llvm::is_contained(Classes, RD)) return; Classes.push_back(RD); Modified: cfe/trunk/lib/Basic/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=353635&r1=353634&r2=353635&view=diff == --- cfe/trunk/lib/Basic/TargetInfo.cpp (original) +++ cfe/trunk/lib/Basic/TargetInfo.cpp Sat Feb 9 21:54:57 2019 @@ -456,7 +456,7 @@ bool TargetInfo::isValidGCCRegisterName( } // Check register names. - if (std::find(Names.begin(), Names.end(), Name) != Names.end()) + if (llvm::is_contained(Names, Name)) return true; // Check any additional names that we have. Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=353635&r1=353634&r2=353635&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Sat Feb 9 21:54:57 2019 @@ -1575,8 +1575,7 @@ void Driver::HandleAutocompletions(Strin // We want to show cc1-only options only when clang is invoked with -cc1 or // -Xclang. - if (std::find(Flags.begin(), Flags.end(), "-Xclang") != Flags.end() || - std::find(Flags.begin(), Flags.end(), "-cc1") != Flags.end()) + if (llvm::is_contained(Flags, "-Xclang") || llvm::is_contained(Flags, "-cc1")) DisableFlags &= ~options::NoDriverOption; StringRef Cur; Modified: cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp?rev=353635&r1=353634&r2=353635&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Arch/AArch64.cpp Sat Feb 9 21:54:57 2019 @@ -207,7 +207,7 @@ void aarch64::getAArch64TargetFeatures(c // TargetParser rewrite. const auto ItRNoFullFP16 = std::find(Features.rbegin(), Features.rend(), "-fullfp16"); const auto ItRFP16FML = std::find(Features.rbegin(), Features.rend(), "+fp16fml"); - if (std::find(Features.begin(), Features.end(), "+v8.4a") != Features.end()) { + if (llvm::is_contained(Features, "+v8.4a")) { const auto ItRFullFP16 = std::find(Features.rbegin(), Features.rend(), "+fullfp16"); if (ItRFullFP16 < ItRNoFullFP16 && ItRFullFP16 < ItRFP16FML) { // Only entangled feature that can be to the right of this +fullfp16 is -fp16fml. @@ -217,8 +217,7 @@ void aarch64::getAArch64TargetFeatures(c } else
r353697 - Format isInSystemMacro after D55782
Author: maskray Date: Mon Feb 11 05:30:04 2019 New Revision: 353697 URL: http://llvm.org/viewvc/llvm-project?rev=353697&view=rev Log: Format isInSystemMacro after D55782 Modified: cfe/trunk/include/clang/Basic/SourceManager.h Modified: cfe/trunk/include/clang/Basic/SourceManager.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=353697&r1=353696&r2=353697&view=diff == --- cfe/trunk/include/clang/Basic/SourceManager.h (original) +++ cfe/trunk/include/clang/Basic/SourceManager.h Mon Feb 11 05:30:04 2019 @@ -1458,17 +1458,15 @@ public: /// Returns whether \p Loc is expanded from a macro in a system header. bool isInSystemMacro(SourceLocation loc) const { -if(!loc.isMacroID()) +if (!loc.isMacroID()) return false; // This happens when the macro is the result of a paste, in that case // its spelling is the scratch memory, so we take the parent context. -if (isWrittenInScratchSpace(getSpellingLoc(loc))) { +if (isWrittenInScratchSpace(getSpellingLoc(loc))) return isInSystemHeader(getSpellingLoc(getImmediateMacroCallerLoc(loc))); -} -else { - return isInSystemHeader(getSpellingLoc(loc)); -} + +return isInSystemHeader(getSpellingLoc(loc)); } /// The size of the SLocEntry that \p FID represents. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r362050 - [Driver] -static-pie: add -z text
Author: maskray Date: Wed May 29 18:55:43 2019 New Revision: 362050 URL: http://llvm.org/viewvc/llvm-project?rev=362050&view=rev Log: [Driver] -static-pie: add -z text This matches gcc -static-pie. The intention is to prevent dynamic relocations in read-only segments. In ld.bfd and gold, -z notext is the default. If text relocations are needed: * -z notext: allow and emit DF_TEXTREL. DF_TEXTREL is not emitted if there is no text relocation. * -z text: error In lld, -z text is the default (this change is a no-op). * -z text: error on text relocations * -z notext: allow text relocations, and emit DF_TEXTREL no matter whether text relocations exist. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D62606 Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/linux-ld.c Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=362050&r1=362049&r2=362050&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Wed May 29 18:55:43 2019 @@ -382,6 +382,8 @@ void tools::gnutools::Linker::ConstructJ CmdArgs.push_back("-static"); CmdArgs.push_back("-pie"); CmdArgs.push_back("--no-dynamic-linker"); +CmdArgs.push_back("-z"); +CmdArgs.push_back("text"); } if (ToolChain.isNoExecStackDefault()) { Modified: cfe/trunk/test/Driver/linux-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=362050&r1=362049&r2=362050&view=diff == --- cfe/trunk/test/Driver/linux-ld.c (original) +++ cfe/trunk/test/Driver/linux-ld.c Wed May 29 18:55:43 2019 @@ -190,6 +190,8 @@ // CHECK-CLANG-LD-STATIC-PIE: "-static" // CHECK-CLANG-LD-STATIC-PIE: "-pie" // CHECK-CLANG-LD-STATIC-PIE: "--no-dynamic-linker" +// CHECK-CLANG-LD-STATIC-PIE: "-z" +// CHECK-CLANG-LD-STATIC-PIE: "text" // CHECK-CLANG-LD-STATIC-PIE: "-m" "elf_x86_64" // CHECK-CLANG-LD-STATIC-PIE: "{{.*}}rcrt1.o" // CHECK-CLANG-LD-STATIC-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group" @@ -203,6 +205,8 @@ // CHECK-CLANG-LD-STATIC-PIE-PIE: "-static" // CHECK-CLANG-LD-STATIC-PIE-PIE: "-pie" // CHECK-CLANG-LD-STATIC-PIE-PIE: "--no-dynamic-linker" +// CHECK-CLANG-LD-STATIC-PIE-PIE: "-z" +// CHECK-CLANG-LD-STATIC-PIE-PIE: "text" // CHECK-CLANG-LD-STATIC-PIE-PIE: "-m" "elf_x86_64" // CHECK-CLANG-LD-STATIC-PIE-PIE: "{{.*}}rcrt1.o" // CHECK-CLANG-LD-STATIC-PIE-PIE: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group" @@ -216,6 +220,8 @@ // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-static" // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-pie" // CHECK-CLANG-LD-STATIC-PIE-STATIC: "--no-dynamic-linker" +// CHECK-CLANG-LD-STATIC-PIE-STATIC: "-z" +// CHECK-CLANG-LD-STATIC-PIE-STATIC: "text" // CHECK-CLANG-LD-STATIC-PIE-STATIC: "-m" "elf_x86_64" // CHECK-CLANG-LD-STATIC-PIE-STATIC: "{{.*}}rcrt1.o" // CHECK-CLANG-LD-STATIC-PIE-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r362051 - [PowerPC] Set the default PLT mode on musl to Secure PLT
Author: maskray Date: Wed May 29 19:13:15 2019 New Revision: 362051 URL: http://llvm.org/viewvc/llvm-project?rev=362051&view=rev Log: [PowerPC] Set the default PLT mode on musl to Secure PLT The musl libc only supports Secure PLT. Patch by A. Wilcox! Reviewed By: jhibbits Differential Revision: https://reviews.llvm.org/D59185 Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp?rev=362051&r1=362050&r2=362051&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp Wed May 29 19:13:15 2019 @@ -115,7 +115,7 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPt const ArgList &Args) { if (Args.getLastArg(options::OPT_msecure_plt)) return ppc::ReadGOTPtrMode::SecurePlt; - if (Triple.isOSNetBSD() || Triple.isOSOpenBSD()) + if (Triple.isOSNetBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) return ppc::ReadGOTPtrMode::SecurePlt; else return ppc::ReadGOTPtrMode::Bss; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r362052 - [Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode
Author: maskray Date: Wed May 29 19:30:04 2019 New Revision: 362052 URL: http://llvm.org/viewvc/llvm-project?rev=362052&view=rev Log: [Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode Modern ELF platforms use -fuse-init-array to emit .init_array instead of .ctors . ld.bfd and gold --ctors-in-init-array merge .init_array and .ctors into .init_array but lld doesn't do that. If crtbegin*.o crtend*.o don't provide .ctors/.dtors, such .ctors in user object files can lead to crash (see PR42002. The first and the last elements in .ctors/.dtors are ignored - they are traditionally provided by crtbegin*.o crtend*.o). Call addClangTargetOptions() to ensure -fuse-init-array is rendered on modern ELF platforms. On Hexagon, this renders -target-feature +reserved-r19 for -ffixed-r19. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D62509 Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/fembed-bitcode.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=362052&r1=362051&r2=362052&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed May 29 19:30:04 2019 @@ -3666,6 +3666,9 @@ void Clang::ConstructJob(Compilation &C, // Disable all llvm IR level optimizations. CmdArgs.push_back("-disable-llvm-passes"); +// Render target options such as -fuse-init-array on modern ELF platforms. +TC.addClangTargetOptions(Args, CmdArgs, JA.getOffloadingDeviceKind()); + // reject options that shouldn't be supported in bitcode // also reject kernel/kext static const constexpr unsigned kBitcodeOptionBlacklist[] = { Modified: cfe/trunk/test/Driver/fembed-bitcode.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fembed-bitcode.c?rev=362052&r1=362051&r2=362052&view=diff == --- cfe/trunk/test/Driver/fembed-bitcode.c (original) +++ cfe/trunk/test/Driver/fembed-bitcode.c Wed May 29 19:30:04 2019 @@ -26,3 +26,11 @@ // CHECK-AARCH64: "darwinpcs" // CHECK-AARCH64-NOT: "-fdebug-compilation-dir" +// RUN: %clang -target x86_64-pc-freebsd12 -fembed-bitcode=all -c %s -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-INITARRAY %s +// CHECK-INITARRAY: "-fuse-init-array" + +// RUN: %clang -target hexagon-unknown-elf -ffixed-r19 -fembed-bitcode=all -c %s -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-HEXAGON %s +// CHECK-HEXAGON: "-target-feature" +// CHECK-HEXAGON: "+reserved-r19" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r362059 - Mark CodeGen/asm-goto.c as x86 specific after r362045
Author: maskray Date: Wed May 29 23:48:13 2019 New Revision: 362059 URL: http://llvm.org/viewvc/llvm-project?rev=362059&view=rev Log: Mark CodeGen/asm-goto.c as x86 specific after r362045 Modified: cfe/trunk/test/CodeGen/asm-goto.c Modified: cfe/trunk/test/CodeGen/asm-goto.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm-goto.c?rev=362059&r1=362058&r2=362059&view=diff == --- cfe/trunk/test/CodeGen/asm-goto.c (original) +++ cfe/trunk/test/CodeGen/asm-goto.c Wed May 29 23:48:13 2019 @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -O0 -emit-llvm %s -o - | FileCheck %s +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 -triple x86_64 -O0 -emit-llvm %s -o - | FileCheck %s int foo(int cond) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits