[PATCH] D58896: Suppress -Wchar-subscripts if the index is a literal char

2019-11-08 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg added a comment.

In D58896#1737242 , @edward-jones 
wrote:

> In D58896#1737113 , @sberg wrote:
>
> > But how about literals like `'\x80'` where the promoted value depends on 
> > whether plain `char` is signed or unsigned?
>
>
> If 'char' is signed and index into an array then this will typically trigger 
> an `-Warray-bounds` warning because it references before the start of the 
> array.


My thought was more that it might be useful as a kind of portability warning.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58896/new/

https://reviews.llvm.org/D58896



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67156: [Analyzer] Debug Checkers for Container and Iterator Inspection

2019-11-08 Thread Balogh, Ádám via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
baloghadamsoftware marked an inline comment as done.
Closed by commit rG0f88caeef8f2: [Analyzer] Checker for Debugging Iterator 
Checkers (authored by baloghadamsoftware).

Changed prior to commit:
  https://reviews.llvm.org/D67156?vs=222984&id=228374#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67156/new/

https://reviews.llvm.org/D67156

Files:
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
  clang/test/Analysis/debug-iterator-modeling.cpp

Index: clang/test/Analysis/debug-iterator-modeling.cpp
===
--- /dev/null
+++ clang/test/Analysis/debug-iterator-modeling.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_analyze_cc1 -std=c++11\
+// RUN: -analyzer-checker=core,cplusplus\
+// RUN: -analyzer-checker=debug.DebugIteratorModeling,debug.ExprInspection\
+// RUN: -analyzer-config aggressive-binary-operation-simplification=true\
+// RUN: -analyzer-config c++-container-inlining=false %s -verify
+
+// RUN: %clang_analyze_cc1 -std=c++11\
+// RUN: -analyzer-checker=core,cplusplus\
+// RUN: -analyzer-checker=debug.DebugIteratorModeling,debug.ExprInspection\
+// RUN: -analyzer-config aggressive-binary-operation-simplification=true\
+// RUN: -analyzer-config c++-container-inlining=true -DINLINE=1 %s -verify
+
+#include "Inputs/system-header-simulator-cxx.h"
+
+template 
+long clang_analyzer_container_begin(const Container&);
+template 
+long clang_analyzer_container_end(const Container&);
+template 
+long clang_analyzer_iterator_position(const Iterator&);
+template 
+void* clang_analyzer_iterator_container(const Iterator&);
+template 
+bool clang_analyzer_iterator_validity(const Iterator&);
+void clang_analyzer_denote(long, const char*);
+void clang_analyzer_express(long);
+void clang_analyzer_dump(const void*);
+void clang_analyzer_eval(bool);
+
+void iterator_position(const std::vector v0) {
+  auto b0 = v0.begin(), e0 = v0.end();
+
+  clang_analyzer_denote(clang_analyzer_iterator_position(b0), "$b0");
+  clang_analyzer_denote(clang_analyzer_iterator_position(e0), "$e0");
+
+  clang_analyzer_express(clang_analyzer_iterator_position(b0)); // expected-warning{{$b0}}
+  clang_analyzer_express(clang_analyzer_iterator_position(e0)); // expected-warning{{$e0}}
+
+  clang_analyzer_express(clang_analyzer_container_begin(v0)); // expected-warning{{$b0}}
+  clang_analyzer_express(clang_analyzer_container_end(v0)); // expected-warning{{$e0}}
+
+  ++b0;
+
+  clang_analyzer_express(clang_analyzer_iterator_position(b0)); // expected-warning{{$b0 + 1}}
+}
+
+void iterator_container(const std::vector v0) {
+  auto b0 = v0.begin();
+
+  clang_analyzer_dump(&v0); //expected-warning{{&v0}}
+  clang_analyzer_eval(clang_analyzer_iterator_container(b0) == &v0); // expected-warning{{TRUE}}
+}
+
+void iterator_validity(std::vector v0) {
+  auto b0 = v0.begin();
+  clang_analyzer_eval(clang_analyzer_iterator_validity(b0)); //expected-warning{{TRUE}}
+
+  v0.clear();
+
+  clang_analyzer_eval(clang_analyzer_iterator_validity(b0)); //expected-warning{{FALSE}}
+}
Index: clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
@@ -173,11 +173,12 @@
 class IteratorChecker
 : public Checker, check::Bind,
- check::LiveSymbols, check::DeadSymbols> {
+ check::LiveSymbols, check::DeadSymbols, eval::Call> {
 
   std::unique_ptr OutOfRangeBugType;
   std::unique_ptr MismatchedBugType;
   std::unique_ptr InvalidatedBugType;
+  std::unique_ptr DebugMsgBugType;
 
   void handleComparison(CheckerContext &C, const Expr *CE, const SVal &RetVal,
 const SVal &LVal, const SVal &RVal,
@@ -236,7 +237,35 @@
ExplodedNode *ErrNode) const;
   void reportInvalidatedBug(const StringRef &Message, const SVal &Val,
 CheckerContext &C, ExplodedNode *ErrNode) const;
-
+  template 
+  void analyzerContainerDataField(const CallExpr *CE, CheckerContext &C,
+  Getter get) const;
+  void analyzerContainerBegin(const CallExpr *CE, CheckerContext &C) const;
+  void analyzerContainerEnd(const CallExpr *CE, CheckerContext &C) const;
+  template 
+  void analyzerIteratorDataField(const CallExpr *CE, CheckerContext &C,
+ Getter get, SVal Default) const;
+  void analyzerIteratorPosition(const CallExpr *CE, CheckerContext &C) const;
+  void analyzerIteratorContainer(const CallExpr *CE, CheckerContext &C) const;
+  void analyzerIteratorValidity(const CallExpr *CE, CheckerContext &C) const;
+  ExplodedNode *reportDebugMsg(llvm::StringRef Msg, CheckerContext &C) const;
+
+  typedef void 

[PATCH] D69935: [DeclCXX] Remove unknown external linkage specifications

2019-11-08 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added a comment.

Don't you need to also remove

  case LinkageSpecDecl::lang_cxx_11:
  case LinkageSpecDecl::lang_cxx_14:

from VisitLinkageSpecDecl in clang-tools-extra/modularize/Modularize.cpp? 
(added in r372714 / e07376a320d to silence a clang warning).
I can't see how that code would compile otherwise?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69935/new/

https://reviews.llvm.org/D69935



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D58896: Suppress -Wchar-subscripts if the index is a literal char

2019-11-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D58896#1738263 , @sberg wrote:

> In D58896#1737242 , @edward-jones 
> wrote:
>
> > In D58896#1737113 , @sberg wrote:
> >
> > > But how about literals like `'\x80'` where the promoted value depends on 
> > > whether plain `char` is signed or unsigned?
> >
> >
> > If 'char' is signed and index into an array then this will typically 
> > trigger an `-Warray-bounds` warning because it references before the start 
> > of the array.
>
>
> My thought was more that it might be useful as a kind of portability warning.


I'm not opposed to the warning per-se, but do you have evidence that the 
situation occurs in real-world code?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58896/new/

https://reviews.llvm.org/D58896



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69263: [clangd] Implement cross-file rename.

2019-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM.

It's probably worth collecting a list of things we need to fix before enabling 
cross-file rename and putting it somewhere (a GitHub issue, maybe?)
Important things that immediately come to mind:

- add range-patching heuristics, measure how good they are
- avoid `O(N^2)` when computing edits (converting from positions to offsets)
- handle implicit references from the index

There are definitely more.




Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:345
+  SourceLocation SourceLocationBeg =
+  SM.getMacroArgExpandedLocation(getBeginningOfIdentifier(
+  RInputs.Pos, SM, AST.getASTContext().getLangOpts()));

hokein wrote:
> ilya-biryukov wrote:
> > Why is this different from `prepareRename`, which does not call 
> > `getMacroArgExpandedLocation`?
> > 
> I didn't change it in this patch, but you raise a good point, `prepareRename` 
> should call `getMacroArgExpandedLocation`.
Yep, makes sense to change it later. Could you put a FIXME, so that we don't 
forget about it?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69263/new/

https://reviews.llvm.org/D69263



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69961: [clangd] Fix a regression of not showing documentation from forward declarations.

2019-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/index/Merge.cpp:195
+bool IsClass = S.SymInfo.Kind == index::SymbolKind::Class ||
+   S.SymInfo.Kind == index::SymbolKind::Struct;
+if (!IsClass || !S.Definition)

NIT: `|| Kind == Union`
I guess it's not very common, though



Comment at: clang-tools-extra/clangd/unittests/IndexTests.cpp:414
   L.Definition.FileURI = "file:/x.h";
+  L.SymInfo.Kind = index::SymbolKind::Class;
   R.Documentation = "Forward declarations because x.h is too big to include";

Could you add a similar test with a non-class symbol that checks the 
documentation is still there?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69961/new/

https://reviews.llvm.org/D69961



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D58896: Suppress -Wchar-subscripts if the index is a literal char

2019-11-08 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg added a comment.

In D58896#1738288 , @aaron.ballman 
wrote:

> In D58896#1738263 , @sberg wrote:
>
> > In D58896#1737242 , @edward-jones 
> > wrote:
> >
> > > In D58896#1737113 , @sberg wrote:
> > >
> > > > But how about literals like `'\x80'` where the promoted value depends 
> > > > on whether plain `char` is signed or unsigned?
> > >
> > >
> > > If 'char' is signed and index into an array then this will typically 
> > > trigger an `-Warray-bounds` warning because it references before the 
> > > start of the array.
> >
> >
> > My thought was more that it might be useful as a kind of portability 
> > warning.
>
>
> I'm not opposed to the warning per-se, but do you have evidence that the 
> situation occurs in real-world code?


No.  (My original comment was driven by my, potentially false, assumption that 
this warning was originally, at least in part, meant to flag portability 
issues---along the lines of: why else would the warning trigger at all when 
`char` is unsigned.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58896/new/

https://reviews.llvm.org/D58896



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69934: [clangd] Implement rename by using SelectionTree and findExplicitReferences.

2019-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clang-tools-extra/clangd/ClangdServer.cpp:326
+// class Foo, but the token under the cursor is not corresponding to the
+// "Foo" range, though the final result is correct.
 SourceLocation Loc = getBeginningOfIdentifier(

hokein wrote:
> ilya-biryukov wrote:
> > I would argue rename should not work in that case.
> > Could we check that the cursor is actually on the name token of the 
> > `NamedDecl` and not rename if it isn't?
> you are probably right, we only allow rename which is triggered on the name 
> token. Will update the patch.
Definitely think we should do it before landing the patch.
Otherwise we'll introduce regressions.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:175
+  tooling::getCanonicalSymbolDeclaration(&RenameDecl), 
AST.getASTContext());
+  llvm::DenseSet TargetIDs;
+  for (auto &USR : RenameUSRs)

hokein wrote:
> ilya-biryukov wrote:
> > Why `USRs`? Could we just check whether the `ND.getCanonicalDecl()` is 
> > there instead?
> checking `ND.getCanonicalDecl()` is not enough, thinking about virtual 
> methods.
> 
> `tooling::getUSRsForDeclaration` does all the black-magic things here, it 
> returns all rename-related decls.
Could you add a comment that we need this to handle virtual methods?



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:185
+  for (const auto *Target : Ref.Targets) {
+auto ID = getSymbolID(Target);
+assert(ID);

Are we sure that USRs will always work here?
I would be protective here, surely there are unhandled cases.



Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:225
   tooling::Replacements FilteredChanges;
-  for (const tooling::SymbolOccurrence &Rename :
-   findOccurrencesWithinFile(AST, RenameDecl)) {
-// Currently, we only support normal rename (one range) for C/C++.
-// FIXME: support multiple-range rename for objective-c methods.
-if (Rename.getNameRanges().size() > 1)
-  continue;
-// We shouldn't have conflicting replacements. If there are conflicts, it
-// means that we have bugs either in clangd or in Rename library, therefore
-// we refuse to perform the rename.
+  for (SourceLocation Loc : findOccurrencesWithinFile(AST, *RenameDecl)) {
+// We shouldn't have conflicting replacements or replacements from 
different

This seems to assume all occurrences are outside macros.
Won't it break in presence of macros?
Do we have tests when the renamed token is:
- inside macro body
- inside macro arguments
?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69934/new/

https://reviews.llvm.org/D69934



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69934: [clangd] Implement rename by using SelectionTree and findExplicitReferences.

2019-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

NIT: a typo in the description:
s/Aslo/Also


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69934/new/

https://reviews.llvm.org/D69934



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69935: [DeclCXX] Remove unknown external linkage specifications

2019-11-08 Thread Sourabh Singh Tomar via Phabricator via cfe-commits
SouraVX added a comment.

I created that patch, for purpose of emitting C++ language standards C++11, 
C++14 in the debug information to be available for consumer's[GDB,LLDB]. 
DW_TAG_lang_c_plus_plus_11 .. 14 --new tags for languages in DWARF5.
Sorry, I think, I missed this unintended additions in LinkageSpecDecl.

BTW, did you plan to completely revert this ??


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69935/new/

https://reviews.llvm.org/D69935



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69948: [Checkers] Added support for freopen to StreamChecker.

2019-11-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment.

From the description `The original stream (if it exists) is closed.` I think it 
is possible that the original stream does "not exist". But a test program 
crashed with NULL argument (but not with a closed file). So null argument is 
not permitted or at least does not work always.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69948/new/

https://reviews.llvm.org/D69948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69961: [clangd] Fix a regression of not showing documentation from forward declarations.

2019-11-08 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 228380.
hokein marked 2 inline comments as done.
hokein added a comment.

- include union type;
- add testcase for non-class symbols;


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69961/new/

https://reviews.llvm.org/D69961

Files:
  clang-tools-extra/clangd/index/Merge.cpp
  clang-tools-extra/clangd/unittests/IndexTests.cpp


Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -411,10 +411,13 @@
   Symbol L, R;
   L.ID = R.ID = SymbolID("x");
   L.Definition.FileURI = "file:/x.h";
+  L.SymInfo.Kind = index::SymbolKind::Class;
   R.Documentation = "Forward declarations because x.h is too big to include";
+  EXPECT_EQ( mergeSymbol(L, R).Documentation, "");
 
-  Symbol M = mergeSymbol(L, R);
-  EXPECT_EQ(M.Documentation, "");
+  L.SymInfo.Kind = index::SymbolKind::Function;
+  R.Documentation = "Documentation from non-class symbols should be included";
+  EXPECT_EQ(mergeSymbol(L, R).Documentation, R.Documentation);
 }
 
 MATCHER_P2(IncludeHeaderWithRef, IncludeHeader, References, "") {
Index: clang-tools-extra/clangd/index/Merge.cpp
===
--- clang-tools-extra/clangd/index/Merge.cpp
+++ clang-tools-extra/clangd/index/Merge.cpp
@@ -186,11 +186,17 @@
 S.Signature = O.Signature;
   if (S.CompletionSnippetSuffix == "")
 S.CompletionSnippetSuffix = O.CompletionSnippetSuffix;
-  // Don't accept documentation from bare forward declarations, if there is a
-  // definition and it didn't provide one. S is often an undocumented class,
-  // and O is a non-canonical forward decl preceded by an irrelevant comment.
-  if (S.Documentation == "" && !S.Definition)
-S.Documentation = O.Documentation;
+  if (S.Documentation == "") {
+// Don't accept documentation from bare forward class declarations, if 
there
+// is a definition and it didn't provide one. S is often an undocumented
+// class, and O is a non-canonical forward decl preceded by an irrelevant
+// comment.
+bool IsClass = S.SymInfo.Kind == index::SymbolKind::Class ||
+   S.SymInfo.Kind == index::SymbolKind::Struct ||
+   S.SymInfo.Kind == index::SymbolKind::Union;
+if (!IsClass || !S.Definition)
+  S.Documentation = O.Documentation;
+  }
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
   if (S.Type == "")


Index: clang-tools-extra/clangd/unittests/IndexTests.cpp
===
--- clang-tools-extra/clangd/unittests/IndexTests.cpp
+++ clang-tools-extra/clangd/unittests/IndexTests.cpp
@@ -411,10 +411,13 @@
   Symbol L, R;
   L.ID = R.ID = SymbolID("x");
   L.Definition.FileURI = "file:/x.h";
+  L.SymInfo.Kind = index::SymbolKind::Class;
   R.Documentation = "Forward declarations because x.h is too big to include";
+  EXPECT_EQ( mergeSymbol(L, R).Documentation, "");
 
-  Symbol M = mergeSymbol(L, R);
-  EXPECT_EQ(M.Documentation, "");
+  L.SymInfo.Kind = index::SymbolKind::Function;
+  R.Documentation = "Documentation from non-class symbols should be included";
+  EXPECT_EQ(mergeSymbol(L, R).Documentation, R.Documentation);
 }
 
 MATCHER_P2(IncludeHeaderWithRef, IncludeHeader, References, "") {
Index: clang-tools-extra/clangd/index/Merge.cpp
===
--- clang-tools-extra/clangd/index/Merge.cpp
+++ clang-tools-extra/clangd/index/Merge.cpp
@@ -186,11 +186,17 @@
 S.Signature = O.Signature;
   if (S.CompletionSnippetSuffix == "")
 S.CompletionSnippetSuffix = O.CompletionSnippetSuffix;
-  // Don't accept documentation from bare forward declarations, if there is a
-  // definition and it didn't provide one. S is often an undocumented class,
-  // and O is a non-canonical forward decl preceded by an irrelevant comment.
-  if (S.Documentation == "" && !S.Definition)
-S.Documentation = O.Documentation;
+  if (S.Documentation == "") {
+// Don't accept documentation from bare forward class declarations, if there
+// is a definition and it didn't provide one. S is often an undocumented
+// class, and O is a non-canonical forward decl preceded by an irrelevant
+// comment.
+bool IsClass = S.SymInfo.Kind == index::SymbolKind::Class ||
+   S.SymInfo.Kind == index::SymbolKind::Struct ||
+   S.SymInfo.Kind == index::SymbolKind::Union;
+if (!IsClass || !S.Definition)
+  S.Documentation = O.Documentation;
+  }
   if (S.ReturnType == "")
 S.ReturnType = O.ReturnType;
   if (S.Type == "")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69995: [clang][IFS] Adding support for processing more decl types in clang interface stubs.

2019-11-08 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi created this revision.
plotfi added a reviewer: compnerd.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch adds support for more decl types that need to be processable, as 
part of clang-ifs hardening.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69995

Files:
  clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
  clang/test/InterfaceStubs/class-template-partial-specialization.cpp
  clang/test/InterfaceStubs/cxx-conversion.cpp
  clang/test/InterfaceStubs/indirect-field-decl.cpp
  clang/test/InterfaceStubs/namespace.cpp
  clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
  clang/test/InterfaceStubs/template-constexpr.cpp
  clang/test/InterfaceStubs/template-template-parm-decl.cpp
  clang/test/InterfaceStubs/trycatch.cpp
  clang/test/InterfaceStubs/usings.cpp
  clang/test/InterfaceStubs/var-template-specialization-decl.cpp

Index: clang/test/InterfaceStubs/var-template-specialization-decl.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/var-template-specialization-decl.cpp
@@ -0,0 +1,17 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang -target x86_64-unknown-linux-gnu -c -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: "a" : { Type: Object, Size: 4 }
+// CHECK-NEXT: ...
+
+template struct S9 {
+static constexpr T value = v;
+};
+template struct S0 : public S9 { };
+template constexpr bool CE2 = S0::value;
+int a = CE2;
\ No newline at end of file
Index: clang/test/InterfaceStubs/usings.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/usings.cpp
@@ -0,0 +1,17 @@
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+template struct S2 { static unsigned f(); };
+template struct S3  { using S2::f; };
+
+typedef struct {} S4;
+using ::S4;
+
+template struct C3{};
+template using U1 = C3;
\ No newline at end of file
Index: clang/test/InterfaceStubs/trycatch.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/trycatch.cpp
@@ -0,0 +1,15 @@
+// REQUIRES: x86-registered-target
+
+// RUN: %clang -target x86_64-unknown-linux-gnu -c -o - -emit-interface-stubs %s | FileCheck %s
+
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: "_Z1fv" : { Type: Func }
+// CHECK-NEXT: ...
+
+class C5 {};
+void f() { try {} catch(C5&){} }
\ No newline at end of file
Index: clang/test/InterfaceStubs/template-template-parm-decl.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/template-template-parm-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+template class a> struct S6 { };
\ No newline at end of file
Index: clang/test/InterfaceStubs/template-constexpr.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/template-constexpr.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+template struct S8 { static constexpr T value = v; };
+template constexpr T S8::value;
\ No newline at end of file
Index: clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/non-type-template-parm-decl.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK:  --- !experimental-ifs-v1
+// CHECK-NEXT: IfsVersion: 1.0
+// CHECK-NEXT: Triple: x86_64-unknown-linux-gnu
+// CHECK-NEXT: ObjectFileFormat: ELF
+// CHECK-NEXT: Symbols:
+// CHECK-NEXT: ...
+
+template struct S1 {};
\ No newline at end of file
Index: clang/test/InterfaceStubs/namespace.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/namespace.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang -c -o - -emit-interface-stubs %s | FileCheck %s
+
+// CHECK

[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 created this revision.
lh123 added reviewers: sammccall, ilya-biryukov, hokein.
lh123 added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous, 
MaskRay.
Herald added a project: clang.

vscode always escapes the colon on the file uri, which causes the semantic 
highlighting fails on windows.

fixes: https://github.com/clangd/clangd/issues/176


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D69996

Files:
  clang-tools-extra/clangd/clients/clangd-vscode/package.json
  clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts


Index: 
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -116,9 +116,9 @@
 this.subscriptions.push(vscode.window.onDidChangeVisibleTextEditors(
 (editors: vscode.TextEditor[]) =>
 editors.forEach((e) => this.highlighter.applyHighlights(
-e.document.uri.toString();
+e.document.uri.toString(true);
 this.subscriptions.push(vscode.workspace.onDidCloseTextDocument(
-(doc) => 
this.highlighter.removeFileHighlightings(doc.uri.toString(;
+(doc) => 
this.highlighter.removeFileHighlightings(doc.uri.toString(true;
   }
 
   handleNotification(params: SemanticHighlightingParams) {
@@ -224,7 +224,8 @@
 // TextEditorDecorationType is used per scope.
 const ranges = this.getDecorationRanges(fileUri);
 vscode.window.visibleTextEditors.forEach((e) => {
-  if (e.document.uri.toString() !== fileUri)
+  // Pass true to prevent escaped colon
+  if (e.document.uri.toString(true) !== fileUri)
 return;
   this.decorationTypes.forEach((d, i) => e.setDecorations(d, ranges[i]));
 });
@@ -239,8 +240,8 @@
 
   // Gets the uris as strings for the currently visible text editors.
   protected getVisibleTextEditorUris(): string[] {
-return vscode.window.visibleTextEditors.map((e) =>
-e.document.uri.toString());
+return vscode.window.visibleTextEditors.map(
+(e) => e.document.uri.toString(true));
   }
 
   // Returns the ranges that should be used when decorating. Index i in the
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.18",
+"version": "0.0.19",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clang.llvm.org/extra/clangd.html";,
 "engines": {


Index: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -116,9 +116,9 @@
 this.subscriptions.push(vscode.window.onDidChangeVisibleTextEditors(
 (editors: vscode.TextEditor[]) =>
 editors.forEach((e) => this.highlighter.applyHighlights(
-e.document.uri.toString();
+e.document.uri.toString(true);
 this.subscriptions.push(vscode.workspace.onDidCloseTextDocument(
-(doc) => this.highlighter.removeFileHighlightings(doc.uri.toString(;
+(doc) => this.highlighter.removeFileHighlightings(doc.uri.toString(true;
   }
 
   handleNotification(params: SemanticHighlightingParams) {
@@ -224,7 +224,8 @@
 // TextEditorDecorationType is used per scope.
 const ranges = this.getDecorationRanges(fileUri);
 vscode.window.visibleTextEditors.forEach((e) => {
-  if (e.document.uri.toString() !== fileUri)
+  // Pass true to prevent escaped colon
+  if (e.document.uri.toString(true) !== fileUri)
 return;
   this.decorationTypes.forEach((d, i) => e.setDecorations(d, ranges[i]));
 });
@@ -239,8 +240,8 @@
 
   // Gets the uris as strings for the currently visible text editors.
   protected getVisibleTextEditorUris(): string[] {
-return vscode.window.visibleTextEditors.map((e) =>
-e.document.uri.toString());
+return vscode.window.visibleTextEditors.map(
+(e) => e.document.uri.toString(true));
   }
 
   // Returns the ranges that should be used when decorating. Index i in the
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===

[PATCH] D69961: [clangd] Fix a regression of not showing documentation from forward declarations.

2019-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: clang-tools-extra/clangd/unittests/IndexTests.cpp:416
   R.Documentation = "Forward declarations because x.h is too big to include";
+  EXPECT_EQ( mergeSymbol(L, R).Documentation, "");
 

NIT: could you also test struct and union?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69961/new/

https://reviews.llvm.org/D69961



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 planned changes to this revision.
lh123 added a comment.

it will cause whitspace escaped problem.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 updated this revision to Diff 228393.
lh123 added a comment.

update diff


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996

Files:
  clang-tools-extra/clangd/clients/clangd-vscode/1.patch
  clang-tools-extra/clangd/clients/clangd-vscode/package.json
  clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts


Index: 
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -124,7 +124,8 @@
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
 (line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
-this.highlighter.highlight(params.textDocument.uri, lines);
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }
   // Disposes of all disposable resources used by this object.
   public dispose() {
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.18",
+"version": "0.0.19",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clang.llvm.org/extra/clangd.html";,
 "engines": {


Index: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -124,7 +124,8 @@
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
 (line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
-this.highlighter.highlight(params.textDocument.uri, lines);
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }
   // Disposes of all disposable resources used by this object.
   public dispose() {
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.18",
+"version": "0.0.19",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clang.llvm.org/extra/clangd.html";,
 "engines": {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 updated this revision to Diff 228397.
lh123 added a comment.

Remove irrelevant files from the patch


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996

Files:
  clang-tools-extra/clangd/clients/clangd-vscode/package.json
  clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts


Index: 
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -124,7 +124,8 @@
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
 (line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
-this.highlighter.highlight(params.textDocument.uri, lines);
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }
   // Disposes of all disposable resources used by this object.
   public dispose() {
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.18",
+"version": "0.0.19",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clang.llvm.org/extra/clangd.html";,
 "engines": {


Index: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -124,7 +124,8 @@
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
 (line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
-this.highlighter.highlight(params.textDocument.uri, lines);
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }
   // Disposes of all disposable resources used by this object.
   public dispose() {
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.18",
+"version": "0.0.19",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clang.llvm.org/extra/clangd.html";,
 "engines": {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67409: [RISCV] enable LTO support, pass some options to linker.

2019-11-08 Thread Kuan Hsu Chen (Zakk) via Phabricator via cfe-commits
khchen marked an inline comment as done.
khchen added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:498
+CmdArgs.push_back(
+Args.MakeArgString(Twine("-plugin-opt=-target-abi=") + ABIName));
 }

efriedma wrote:
> I don't think this change is right.  In general, target features should be 
> encoded in bitcode files.  This allows compiling different files with 
> different target features, and using runtime detection to only run certain 
> codepaths.  And it makes sure that we end up with a sane result if the user 
> doesn't pass target feature flags on the link line.
> 
> Also, it probably isn't appropriate to make target-independent changes in a 
> commit tagged [RISCV]; most people would assume a change marked like that 
> doesn't have target-independent effects.
> 
> (Sorry about the delayed response to this review; I only just ran into this.)
> I don't think this change is right. In general, target features should be 
> encoded in bitcode files. This allows compiling different files with 
> different target features, and using runtime detection to only run certain 
> codepaths. And it makes sure that we end up with a sane result if the user 
> doesn't pass target feature flags on the link line.
> 

I'm curious about your scenario, LTO will link two bitcodes file into one, so 
which target-features should be kept in final bitcode since different files 
have different target features? For example, one target features" is "+armv7-a" 
and another is "+armv8-a". 

I guess maybe your case is they are same target-features in different files, 
but this patch will overwrite the encoded target-feature as default.

anyway, I agree with you. I found the target features does not encoded in 
bitcode files when enabling LTO in RISCV, I will fixed it and revert the target 
feature part, thanks.


> Also, it probably isn't appropriate to make target-independent changes in a 
> commit tagged [RISCV]; most people would assume a change marked like that 
> doesn't have target-independent effects.
> 
sorry,  I will take care of it in next time.

> (Sorry about the delayed response to this review; I only just ran into this.)




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67409/new/

https://reviews.llvm.org/D67409



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 updated this revision to Diff 228405.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996

Files:
  clang-tools-extra/clangd/clients/clangd-vscode/package.json
  clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts


Index: 
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -124,7 +124,8 @@
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
 (line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
-this.highlighter.highlight(params.textDocument.uri, lines);
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }
   // Disposes of all disposable resources used by this object.
   public dispose() {
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.18",
+"version": "0.0.19",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clang.llvm.org/extra/clangd.html";,
 "engines": {


Index: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
===
--- clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
+++ clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts
@@ -124,7 +124,8 @@
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
 (line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
-this.highlighter.highlight(params.textDocument.uri, lines);
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }
   // Disposes of all disposable resources used by this object.
   public dispose() {
Index: clang-tools-extra/clangd/clients/clangd-vscode/package.json
===
--- clang-tools-extra/clangd/clients/clangd-vscode/package.json
+++ clang-tools-extra/clangd/clients/clangd-vscode/package.json
@@ -2,7 +2,7 @@
 "name": "vscode-clangd",
 "displayName": "vscode-clangd",
 "description": "Clang Language Server",
-"version": "0.0.18",
+"version": "0.0.19",
 "publisher": "llvm-vs-code-extensions",
 "homepage": "https://clang.llvm.org/extra/clangd.html";,
 "engines": {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70003: [clang-format] Ensure dump_format_style.py can generate ClangFormatStyleOptions.rst without manual intervention

2019-11-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

Just in case you want proof the generated html looks the same:

F10665472: image.png 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70003/new/

https://reviews.llvm.org/D70003



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70003: [clang-format] Ensure dump_format_style.py can generate ClangFormatStyleOptions.rst without manual intervention

2019-11-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: mitchell-stellar, klimek, sammccall, owenpan.
MyDeveloperDay added projects: clang-format, clang.
MyDeveloperDay added a comment.

Just in case you want proof the generated html looks the same:

F10665472: image.png 


This revision is the last in a series of revisions to return 
`clang/doc/tools/dump_format_style.py` to be being able to parse Format.h 
without needing to manually merge the ClangFormatStyleOptions.rst file.

The final modification to dump_format_style.py is needed following the addition 
of a  nested enumeration inside a nested structure following the introduction 
of D68296: [clang-format] Add ability to wrap braces after multi-line control 
statements 

Prior  related revisions will allow for a fully clang-formatted 
`clang/include/clang/Format/Format.h` to once again be used at the source.
D69951: [clang-format] NFC allow Format.h to be clang-formatted but still 
maintain the same doc layout in ClangFormatStyleOptions.rst 

D69433: [clang-format] [NFC] update the documentation in Format.h to allow 
dump_format_style.py to get a little closer to being correct. (part 2) 

D69404: [clang-format] [NFC] update the documentation in Format.h to allow 
dump_format_style.py to get a little closer to being correct. 



Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70003

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/tools/dump_format_style.py


Index: clang/docs/tools/dump_format_style.py
===
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -77,6 +77,20 @@
   def __str__(self):
 return '\n'.join(map(str, self.values))
 
+class NestedEnum(object):
+  def __init__(self, name, enumtype, comment, values):
+self.name = name
+self.comment = comment
+self.values = values
+self.type = enumtype
+
+  def __str__(self):
+s = '\n* ``%s %s``\n%s' % (self.type, self.name,
+ doxygen2rst(indent(self.comment, 2)))
+s += indent('\nPossible values:\n\n', 2)
+s += indent('\n'.join(map(str, self.values)),2)
+return s;
+
 class EnumValue(object):
   def __init__(self, name, comment, config):
 self.name = name
@@ -156,7 +170,12 @@
 comment += clean_comment_line(line)
   else:
 state = State.InNestedStruct
-nested_struct.values.append(NestedField(line.replace(';', ''), 
comment))
+field_type, field_name = 
re.match(r'([<>:\w(,\s)]+)\s+(\w+);',line).groups()
+if field_type in enums:
+
nested_struct.values.append(NestedEnum(field_name,field_type,comment,enums[field_type].values))
+else:
+nested_struct.values.append(NestedField(field_type + " " + 
field_name, comment))
+
 elif state == State.InEnum:
   if line.startswith('///'):
 state = State.InEnumMemberComment
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -819,6 +819,7 @@
 for (int i = 0; i < 10; ++i)
 {}
 
+
   * ``bool AfterEnum`` Wrap enum definitions.
 
 .. code-block:: c++


Index: clang/docs/tools/dump_format_style.py
===
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -77,6 +77,20 @@
   def __str__(self):
 return '\n'.join(map(str, self.values))
 
+class NestedEnum(object):
+  def __init__(self, name, enumtype, comment, values):
+self.name = name
+self.comment = comment
+self.values = values
+self.type = enumtype
+
+  def __str__(self):
+s = '\n* ``%s %s``\n%s' % (self.type, self.name,
+ doxygen2rst(indent(self.comment, 2)))
+s += indent('\nPossible values:\n\n', 2)
+s += indent('\n'.join(map(str, self.values)),2)
+return s;
+
 class EnumValue(object):
   def __init__(self, name, comment, config):
 self.name = name
@@ -156,7 +170,12 @@
 comment += clean_comment_line(line)
   else:
 state = State.InNestedStruct
-nested_struct.values.append(NestedField(line.replace(';', ''), comment))
+field_type, field_name = re.match(r'([<>:\w(,\s)]+)\s+(\w+);',line).groups()
+if field_type in enums:
+nested_struct.values.append(NestedEnum(field_name,field_type,comment,enums[field_type].values))
+else:
+nested_struct.values.append(NestedField(field_type + " " + field_name, comment))
+
 elif state == State.InEnum:
   if line.startswith('///'):
 state = State.InEnumMemberComment
Index: clang/docs/ClangFormatStyleOption

[PATCH] D69800: [AArch64][SVE] Implement remaining floating-point arithmetic intrinsics

2019-11-08 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: llvm/test/CodeGen/AArch64/sve-intrinsics-fp-arith.ll:767
 ;
-; FSCALE
+; FNEG
 ;

Why are you moving this test and changing fscale -> fneg here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69800/new/

https://reviews.llvm.org/D69800



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69858: [AArch64][SVE] Implement floating-point comparison & reduction intrinsics

2019-11-08 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen accepted this revision.
sdesmalen added a comment.
This revision is now accepted and ready to land.

Thanks, LGTM!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69858/new/

https://reviews.llvm.org/D69858



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69800: [AArch64][SVE] Implement remaining floating-point arithmetic intrinsics

2019-11-08 Thread Kerry McLaughlin via Phabricator via cfe-commits
kmclaughlin marked an inline comment as done.
kmclaughlin added inline comments.



Comment at: llvm/test/CodeGen/AArch64/sve-intrinsics-fp-arith.ll:767
 ;
-; FSCALE
+; FNEG
 ;

sdesmalen wrote:
> Why are you moving this test and changing fscale -> fneg here?
The rest of the tests here are in order and I noticed that fscale was in the 
wrong place, so I moved it further down.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69800/new/

https://reviews.llvm.org/D69800



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69935: [DeclCXX] Remove unknown external linkage specifications

2019-11-08 Thread Ehud Katz via Phabricator via cfe-commits
ekatz added a comment.

In D69935#1738311 , @SouraVX wrote:

> I created that patch, for purpose of emitting C++ language standards C++11, 
> C++14 in the debug information to be available for consumer's[GDB,LLDB]. 
>  DW_TAG_lang_c_plus_plus_11 .. 14 --new tags for languages in DWARF5.
>  Sorry, I think, I missed this unintended additions in LinkageSpecDecl.
>
> BTW, did you plan to completely revert this ??


This is only a partial revert. It reverts only the part of the linkage 
languages. The other parts changed are untouched. You have also added a test, 
which should still pass.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69935/new/

https://reviews.llvm.org/D69935



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69707: [AArch64][SVE] Implement additional floating-point arithmetic intrinsics

2019-11-08 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen added inline comments.



Comment at: llvm/lib/Target/AArch64/AArch64InstrFormats.td:10064
+ SDNodeXFormgetTargetConstant((N->getSExtValue() / 90), SDLoc(N), 
MVT::i64);
+}]>> {

should the target constant not be MVT::i32 here?



Comment at: llvm/lib/Target/AArch64/AArch64InstrFormats.td:10071
+ SDNodeXFormgetTargetConstant(((N->getSExtValue() - 90) / 180), SDLoc(N), 
MVT::i64);
+}]>> {

Same here


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69707/new/

https://reviews.llvm.org/D69707



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69935: [DeclCXX] Remove unknown external linkage specifications

2019-11-08 Thread Sourabh Singh Tomar via Phabricator via cfe-commits
SouraVX added a comment.

In D69935#1738563 , @ekatz wrote:

> In D69935#1738311 , @SouraVX wrote:
>
> > I created that patch, for purpose of emitting C++ language standards C++11, 
> > C++14 in the debug information to be available for consumer's[GDB,LLDB]. 
> >  DW_TAG_lang_c_plus_plus_11 .. 14 --new tags for languages in DWARF5.
> >  Sorry, I think, I missed this unintended additions in LinkageSpecDecl.
> >
> > BTW, did you plan to completely revert this ??
>
>
> This is only a partial revert. It reverts only the part of the linkage 
> languages. The other parts changed are untouched. You have also added a test, 
> which should still pass.


Thank you! +1 from my side. I'm kinda still new here. So you can wait for 
acceptance from other reviewers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69935/new/

https://reviews.llvm.org/D69935



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D63131: arm64_32: implement the desired ABI for the ILP32 triple.

2019-11-08 Thread JF Bastien via Phabricator via cfe-commits
jfb accepted this revision.
jfb added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: dexonsmith.

Minor comments, but otherwise LGTM.




Comment at: clang/lib/Basic/Targets/AArch64.cpp:167
   // Target properties.
-  if (!getTriple().isOSWindows()) {
+  if (!getTriple().isOSWindows() && getTriple().isArch64Bit()) {
 Builder.defineMacro("_LP64");

This might affect odd non-Darwin targets? Seems unlikely, but just asking since 
we have existence proof with Windows that stuff is weird. Admittedly they're 
untested if it affects them, so I think this is fine.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5457
   // for AArch64, emit a warning and ignore the flag. Otherwise, add the
   // proper mllvm flags.
+  if (Triple.getArch() != llvm::Triple::aarch64 &&

The comment isn't quite right anymore. Maybe don't say `AArch64` since the code 
is obvious about what it checks?



Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:59
   .Cases("armv7s", "xscale", llvm::Triple::arm)
-  .Case("arm64", llvm::Triple::aarch64)
+  .Case("arm64",  llvm::Triple::aarch64)
+  .Case("arm64_32", llvm::Triple::aarch64_32)

Extra space.



Comment at: clang/lib/Sema/SemaChecking.cpp:5512
+  bool IsAArch64 = (TT.getArch() == llvm::Triple::aarch64 ||
+TT.getArch() == llvm::Triple::aarch64_32);
   bool IsWindows = TT.isOSWindows();

This is now a weird variable name, since it's aarch64 maybe 32 but not be. 
Could you rename `IsAArch64`?



Comment at: clang/test/CodeGen/builtins-arm64.c:11
 
+#if __LP64__
 void *tp (void) {

Why isn't this one supported?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63131/new/

https://reviews.llvm.org/D63131



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6b45e1b - Revert "[clang] Report sanitizer blacklist as a dependency in cc1"

2019-11-08 Thread Jeremy Morse via cfe-commits

Author: Jeremy Morse
Date: 2019-11-08T12:07:42Z
New Revision: 6b45e1bc11e91ea7b57a6ab1c19461a86dba33f8

URL: 
https://github.com/llvm/llvm-project/commit/6b45e1bc11e91ea7b57a6ab1c19461a86dba33f8
DIFF: 
https://github.com/llvm/llvm-project/commit/6b45e1bc11e91ea7b57a6ab1c19461a86dba33f8.diff

LOG: Revert "[clang] Report sanitizer blacklist as a dependency in cc1"

This reverts commit 03b84e4f6d0e1c04f22d69cc445f36e1f713beb4.

This breaks dfsan tests with a linking failure, in for example this build:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/24312

Reverting this patch locally makes those tests succeed.

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/include/clang/Driver/SanitizerArgs.h
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Driver/fsanitize-blacklist.c
clang/test/Frontend/dependency-gen.c

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index c2e30a16b8da..dcd2976a97f2 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -979,9 +979,6 @@ def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, 
Group,
 def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
   Group,
   HelpText<"Path to blacklist file for sanitizers">;
-def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">,
-  HelpText<"Path to system blacklist file for sanitizers">,
-  Flags<[CC1Option]>;
 def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">,
  Group,
  HelpText<"Don't use blacklist file for 
sanitizers">;

diff  --git a/clang/include/clang/Driver/SanitizerArgs.h 
b/clang/include/clang/Driver/SanitizerArgs.h
index 0aebf8cb225d..c37499e0f201 100644
--- a/clang/include/clang/Driver/SanitizerArgs.h
+++ b/clang/include/clang/Driver/SanitizerArgs.h
@@ -25,8 +25,8 @@ class SanitizerArgs {
   SanitizerSet RecoverableSanitizers;
   SanitizerSet TrapSanitizers;
 
-  std::vector UserBlacklistFiles;
-  std::vector SystemBlacklistFiles;
+  std::vector BlacklistFiles;
+  std::vector ExtraDeps;
   int CoverageFeatures = 0;
   int MsanTrackOrigins = 0;
   bool MsanUseAfterDtor = true;

diff  --git a/clang/lib/Driver/SanitizerArgs.cpp 
b/clang/lib/Driver/SanitizerArgs.cpp
index 8937197c253c..cc6c5e6ef438 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -557,35 +557,29 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
 
   // Setup blacklist files.
   // Add default blacklist from resource directory.
-  addDefaultBlacklists(D, Kinds, SystemBlacklistFiles);
+  addDefaultBlacklists(D, Kinds, BlacklistFiles);
   // Parse -f(no-)sanitize-blacklist options.
   for (const auto *Arg : Args) {
 if (Arg->getOption().matches(options::OPT_fsanitize_blacklist)) {
   Arg->claim();
   std::string BLPath = Arg->getValue();
   if (llvm::sys::fs::exists(BLPath)) {
-UserBlacklistFiles.push_back(BLPath);
+BlacklistFiles.push_back(BLPath);
+ExtraDeps.push_back(BLPath);
   } else {
 D.Diag(clang::diag::err_drv_no_such_file) << BLPath;
   }
 } else if (Arg->getOption().matches(options::OPT_fno_sanitize_blacklist)) {
   Arg->claim();
-  UserBlacklistFiles.clear();
-  SystemBlacklistFiles.clear();
+  BlacklistFiles.clear();
+  ExtraDeps.clear();
 }
   }
   // Validate blacklists format.
   {
 std::string BLError;
 std::unique_ptr SCL(
-llvm::SpecialCaseList::create(UserBlacklistFiles, BLError));
-if (!SCL.get())
-  D.Diag(clang::diag::err_drv_malformed_sanitizer_blacklist) << BLError;
-  }
-  {
-std::string BLError;
-std::unique_ptr SCL(
-llvm::SpecialCaseList::create(SystemBlacklistFiles, BLError));
+llvm::SpecialCaseList::create(BlacklistFiles, BLError));
 if (!SCL.get())
   D.Diag(clang::diag::err_drv_malformed_sanitizer_blacklist) << BLError;
   }
@@ -958,15 +952,15 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const 
llvm::opt::ArgList &Args,
 CmdArgs.push_back(
 Args.MakeArgString("-fsanitize-trap=" + toString(TrapSanitizers)));
 
-  for (const auto &BLPath : UserBlacklistFiles) {
+  for (const auto &BLPath : BlacklistFiles) {
 SmallString<64> BlacklistOpt("-fsanitize-blacklist=");
 BlacklistOpt += BLPath;
 CmdArgs.push_back(Args.MakeArgString(BlacklistOpt));
   }
-  for (const auto &BLPath : SystemBlacklistFiles) {
-SmallString<64> BlacklistOpt("-fsanitize-system-blacklist=");
-BlacklistOpt += BLPath;
-CmdArgs.push_back(Args.MakeArgString(BlacklistOpt));
+  for (const auto &Dep : ExtraDeps) {
+SmallString<64> ExtraDepOpt("-fdepfile-entry=");
+ExtraDepOpt += Dep;
+CmdArgs.push_back(Ar

Re: [clang] 03b84e4 - [clang] Report sanitizer blacklist as a dependency in cc1

2019-11-08 Thread Jeremy Morse via cfe-commits
Hi Jan,

As the dfsan tests have been failing for a bit, I've reverted this in
6b45e1bc, and the follow-up patch in d6be9273c, to clear the
buildbots.

--
Thanks,
Jeremy
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: 
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts:128
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }

Could we accept a `URI` in the `highlight` (and similar function in 
highlighting) instead and compare the URIs instead of strings in the 
`Highlighter.applyHighlightings`?

i.e. in code:
```
 fileUri : string;
 if (e.document.uri.toString() !== fileUri) 
   return;
```
Could instead be:
```
 fileUri : Uri;
 if (e.document.uri.toString() !== fileUri.toString()) 
   return;
```


This should normalize accordingly and is generally safer and more readable than 
passing around strings.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] b0a03f2 - test commit

2019-11-08 Thread Abel Kocsis via cfe-commits

Author: Abel Kocsis
Date: 2019-11-08T13:35:49+01:00
New Revision: b0a03f29d9a2d316d6be99e6a4825114f240c0b2

URL: 
https://github.com/llvm/llvm-project/commit/b0a03f29d9a2d316d6be99e6a4825114f240c0b2
DIFF: 
https://github.com/llvm/llvm-project/commit/b0a03f29d9a2d316d6be99e6a4825114f240c0b2.diff

LOG: test commit

Added: 


Modified: 
clang/README.txt

Removed: 




diff  --git a/clang/README.txt b/clang/README.txt
index 91527b094856..b5f33bb66dd3 100644
--- a/clang/README.txt
+++ b/clang/README.txt
@@ -24,3 +24,4 @@ on the Clang development mailing list:
 
 If you find a bug in Clang, please file it in the LLVM bug tracker:
   http://llvm.org/bugs/
+



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69962: [CFG] Fix a flaky crash in CFGBlock::getLastCondition().

2019-11-08 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

Nice catch! Though, wouldn't the memory sanitizer buildbots break on this 
reliably?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69962/new/

https://reviews.llvm.org/D69962



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 3182027 - Revert "Revert "[clang] Report sanitizer blacklist as a dependency in cc1""

2019-11-08 Thread Abel Kocsis via cfe-commits

Author: Abel Kocsis
Date: 2019-11-08T14:00:44+01:00
New Revision: 3182027282c59c51d5080d83365917fccd695854

URL: 
https://github.com/llvm/llvm-project/commit/3182027282c59c51d5080d83365917fccd695854
DIFF: 
https://github.com/llvm/llvm-project/commit/3182027282c59c51d5080d83365917fccd695854.diff

LOG: Revert "Revert "[clang] Report sanitizer blacklist as a dependency in cc1""

This reverts commit 6b45e1bc11e91ea7b57a6ab1c19461a86dba33f8.

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/include/clang/Driver/SanitizerArgs.h
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Driver/fsanitize-blacklist.c
clang/test/Frontend/dependency-gen.c

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index dcd2976a97f2..c2e30a16b8da 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -979,6 +979,9 @@ def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, 
Group,
 def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
   Group,
   HelpText<"Path to blacklist file for sanitizers">;
+def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">,
+  HelpText<"Path to system blacklist file for sanitizers">,
+  Flags<[CC1Option]>;
 def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">,
  Group,
  HelpText<"Don't use blacklist file for 
sanitizers">;

diff  --git a/clang/include/clang/Driver/SanitizerArgs.h 
b/clang/include/clang/Driver/SanitizerArgs.h
index c37499e0f201..0aebf8cb225d 100644
--- a/clang/include/clang/Driver/SanitizerArgs.h
+++ b/clang/include/clang/Driver/SanitizerArgs.h
@@ -25,8 +25,8 @@ class SanitizerArgs {
   SanitizerSet RecoverableSanitizers;
   SanitizerSet TrapSanitizers;
 
-  std::vector BlacklistFiles;
-  std::vector ExtraDeps;
+  std::vector UserBlacklistFiles;
+  std::vector SystemBlacklistFiles;
   int CoverageFeatures = 0;
   int MsanTrackOrigins = 0;
   bool MsanUseAfterDtor = true;

diff  --git a/clang/lib/Driver/SanitizerArgs.cpp 
b/clang/lib/Driver/SanitizerArgs.cpp
index cc6c5e6ef438..8937197c253c 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -557,29 +557,35 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
 
   // Setup blacklist files.
   // Add default blacklist from resource directory.
-  addDefaultBlacklists(D, Kinds, BlacklistFiles);
+  addDefaultBlacklists(D, Kinds, SystemBlacklistFiles);
   // Parse -f(no-)sanitize-blacklist options.
   for (const auto *Arg : Args) {
 if (Arg->getOption().matches(options::OPT_fsanitize_blacklist)) {
   Arg->claim();
   std::string BLPath = Arg->getValue();
   if (llvm::sys::fs::exists(BLPath)) {
-BlacklistFiles.push_back(BLPath);
-ExtraDeps.push_back(BLPath);
+UserBlacklistFiles.push_back(BLPath);
   } else {
 D.Diag(clang::diag::err_drv_no_such_file) << BLPath;
   }
 } else if (Arg->getOption().matches(options::OPT_fno_sanitize_blacklist)) {
   Arg->claim();
-  BlacklistFiles.clear();
-  ExtraDeps.clear();
+  UserBlacklistFiles.clear();
+  SystemBlacklistFiles.clear();
 }
   }
   // Validate blacklists format.
   {
 std::string BLError;
 std::unique_ptr SCL(
-llvm::SpecialCaseList::create(BlacklistFiles, BLError));
+llvm::SpecialCaseList::create(UserBlacklistFiles, BLError));
+if (!SCL.get())
+  D.Diag(clang::diag::err_drv_malformed_sanitizer_blacklist) << BLError;
+  }
+  {
+std::string BLError;
+std::unique_ptr SCL(
+llvm::SpecialCaseList::create(SystemBlacklistFiles, BLError));
 if (!SCL.get())
   D.Diag(clang::diag::err_drv_malformed_sanitizer_blacklist) << BLError;
   }
@@ -952,15 +958,15 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const 
llvm::opt::ArgList &Args,
 CmdArgs.push_back(
 Args.MakeArgString("-fsanitize-trap=" + toString(TrapSanitizers)));
 
-  for (const auto &BLPath : BlacklistFiles) {
+  for (const auto &BLPath : UserBlacklistFiles) {
 SmallString<64> BlacklistOpt("-fsanitize-blacklist=");
 BlacklistOpt += BLPath;
 CmdArgs.push_back(Args.MakeArgString(BlacklistOpt));
   }
-  for (const auto &Dep : ExtraDeps) {
-SmallString<64> ExtraDepOpt("-fdepfile-entry=");
-ExtraDepOpt += Dep;
-CmdArgs.push_back(Args.MakeArgString(ExtraDepOpt));
+  for (const auto &BLPath : SystemBlacklistFiles) {
+SmallString<64> BlacklistOpt("-fsanitize-system-blacklist=");
+BlacklistOpt += BLPath;
+CmdArgs.push_back(Args.MakeArgString(BlacklistOpt));
   }
 
   if (MsanTrackOrigins)

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 195a29d71187..17fd4ce

[clang] 9b8413a - Revert "Revert "Revert "[clang] Report sanitizer blacklist as a dependency in cc1"""

2019-11-08 Thread Abel Kocsis via cfe-commits

Author: Abel Kocsis
Date: 2019-11-08T14:08:15+01:00
New Revision: 9b8413ac6e56e7a6e0ba884773d13bcf9414bd43

URL: 
https://github.com/llvm/llvm-project/commit/9b8413ac6e56e7a6e0ba884773d13bcf9414bd43
DIFF: 
https://github.com/llvm/llvm-project/commit/9b8413ac6e56e7a6e0ba884773d13bcf9414bd43.diff

LOG: Revert "Revert "Revert "[clang] Report sanitizer blacklist as a dependency 
in cc1"""

This reverts commit 3182027282c59c51d5080d83365917fccd695854.

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/include/clang/Driver/SanitizerArgs.h
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/Driver/fsanitize-blacklist.c
clang/test/Frontend/dependency-gen.c

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index c2e30a16b8da..dcd2976a97f2 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -979,9 +979,6 @@ def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, 
Group,
 def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,
   Group,
   HelpText<"Path to blacklist file for sanitizers">;
-def fsanitize_system_blacklist : Joined<["-"], "fsanitize-system-blacklist=">,
-  HelpText<"Path to system blacklist file for sanitizers">,
-  Flags<[CC1Option]>;
 def fno_sanitize_blacklist : Flag<["-"], "fno-sanitize-blacklist">,
  Group,
  HelpText<"Don't use blacklist file for 
sanitizers">;

diff  --git a/clang/include/clang/Driver/SanitizerArgs.h 
b/clang/include/clang/Driver/SanitizerArgs.h
index 0aebf8cb225d..c37499e0f201 100644
--- a/clang/include/clang/Driver/SanitizerArgs.h
+++ b/clang/include/clang/Driver/SanitizerArgs.h
@@ -25,8 +25,8 @@ class SanitizerArgs {
   SanitizerSet RecoverableSanitizers;
   SanitizerSet TrapSanitizers;
 
-  std::vector UserBlacklistFiles;
-  std::vector SystemBlacklistFiles;
+  std::vector BlacklistFiles;
+  std::vector ExtraDeps;
   int CoverageFeatures = 0;
   int MsanTrackOrigins = 0;
   bool MsanUseAfterDtor = true;

diff  --git a/clang/lib/Driver/SanitizerArgs.cpp 
b/clang/lib/Driver/SanitizerArgs.cpp
index 8937197c253c..cc6c5e6ef438 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -557,35 +557,29 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
 
   // Setup blacklist files.
   // Add default blacklist from resource directory.
-  addDefaultBlacklists(D, Kinds, SystemBlacklistFiles);
+  addDefaultBlacklists(D, Kinds, BlacklistFiles);
   // Parse -f(no-)sanitize-blacklist options.
   for (const auto *Arg : Args) {
 if (Arg->getOption().matches(options::OPT_fsanitize_blacklist)) {
   Arg->claim();
   std::string BLPath = Arg->getValue();
   if (llvm::sys::fs::exists(BLPath)) {
-UserBlacklistFiles.push_back(BLPath);
+BlacklistFiles.push_back(BLPath);
+ExtraDeps.push_back(BLPath);
   } else {
 D.Diag(clang::diag::err_drv_no_such_file) << BLPath;
   }
 } else if (Arg->getOption().matches(options::OPT_fno_sanitize_blacklist)) {
   Arg->claim();
-  UserBlacklistFiles.clear();
-  SystemBlacklistFiles.clear();
+  BlacklistFiles.clear();
+  ExtraDeps.clear();
 }
   }
   // Validate blacklists format.
   {
 std::string BLError;
 std::unique_ptr SCL(
-llvm::SpecialCaseList::create(UserBlacklistFiles, BLError));
-if (!SCL.get())
-  D.Diag(clang::diag::err_drv_malformed_sanitizer_blacklist) << BLError;
-  }
-  {
-std::string BLError;
-std::unique_ptr SCL(
-llvm::SpecialCaseList::create(SystemBlacklistFiles, BLError));
+llvm::SpecialCaseList::create(BlacklistFiles, BLError));
 if (!SCL.get())
   D.Diag(clang::diag::err_drv_malformed_sanitizer_blacklist) << BLError;
   }
@@ -958,15 +952,15 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const 
llvm::opt::ArgList &Args,
 CmdArgs.push_back(
 Args.MakeArgString("-fsanitize-trap=" + toString(TrapSanitizers)));
 
-  for (const auto &BLPath : UserBlacklistFiles) {
+  for (const auto &BLPath : BlacklistFiles) {
 SmallString<64> BlacklistOpt("-fsanitize-blacklist=");
 BlacklistOpt += BLPath;
 CmdArgs.push_back(Args.MakeArgString(BlacklistOpt));
   }
-  for (const auto &BLPath : SystemBlacklistFiles) {
-SmallString<64> BlacklistOpt("-fsanitize-system-blacklist=");
-BlacklistOpt += BLPath;
-CmdArgs.push_back(Args.MakeArgString(BlacklistOpt));
+  for (const auto &Dep : ExtraDeps) {
+SmallString<64> ExtraDepOpt("-fdepfile-entry=");
+ExtraDepOpt += Dep;
+CmdArgs.push_back(Args.MakeArgString(ExtraDepOpt));
   }
 
   if (MsanTrackOrigins)

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 17fd4ce7752

[clang] 9fcf2a3 - Revert "test commit"

2019-11-08 Thread Abel Kocsis via cfe-commits

Author: Abel Kocsis
Date: 2019-11-08T14:08:46+01:00
New Revision: 9fcf2a38c202efcf7d221173a2b3a484d66c67e8

URL: 
https://github.com/llvm/llvm-project/commit/9fcf2a38c202efcf7d221173a2b3a484d66c67e8
DIFF: 
https://github.com/llvm/llvm-project/commit/9fcf2a38c202efcf7d221173a2b3a484d66c67e8.diff

LOG: Revert "test commit"

This reverts commit 3ffce13f8c7ecb21c5729aa358f1f9fc008bbea2.

Added: 


Modified: 
clang/README.txt

Removed: 




diff  --git a/clang/README.txt b/clang/README.txt
index 835acb3b0dd4..b5f33bb66dd3 100644
--- a/clang/README.txt
+++ b/clang/README.txt
@@ -25,4 +25,3 @@ on the Clang development mailing list:
 If you find a bug in Clang, please file it in the LLVM bug tracker:
   http://llvm.org/bugs/
 
-



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c0a7732 - Revert "test commit"

2019-11-08 Thread Abel Kocsis via cfe-commits

Author: Abel Kocsis
Date: 2019-11-08T14:09:09+01:00
New Revision: c0a77329d46f3577357645e0aa316174798e54cc

URL: 
https://github.com/llvm/llvm-project/commit/c0a77329d46f3577357645e0aa316174798e54cc
DIFF: 
https://github.com/llvm/llvm-project/commit/c0a77329d46f3577357645e0aa316174798e54cc.diff

LOG: Revert "test commit"

This reverts commit b0a03f29d9a2d316d6be99e6a4825114f240c0b2.

Added: 


Modified: 
clang/README.txt

Removed: 




diff  --git a/clang/README.txt b/clang/README.txt
index b5f33bb66dd3..91527b094856 100644
--- a/clang/README.txt
+++ b/clang/README.txt
@@ -24,4 +24,3 @@ on the Clang development mailing list:
 
 If you find a bug in Clang, please file it in the LLVM bug tracker:
   http://llvm.org/bugs/
-



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38446: update comments in clang-format.py for python3 compatibility

2019-11-08 Thread Paul Seyfert via Phabricator via cfe-commits
pseyfert added a comment.

thanks for the ping. looking back at Code Reviews with Phabricator 
, the following applies to me: "If you 
do not have commit access, someone has to commit the change for you (with 
attribution)." so, yes I need help landing.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D38446/new/

https://reviews.llvm.org/D38446



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6bf9e88 - [clang-format] update comments in clang-format.py for python3 compatibility

2019-11-08 Thread via cfe-commits

Author: paulhoad
Date: 2019-11-08T13:17:04Z
New Revision: 6bf9e88ae4a45ee43eef3c7978040d33cead59ce

URL: 
https://github.com/llvm/llvm-project/commit/6bf9e88ae4a45ee43eef3c7978040d33cead59ce
DIFF: 
https://github.com/llvm/llvm-project/commit/6bf9e88ae4a45ee43eef3c7978040d33cead59ce.diff

LOG: [clang-format] update comments in clang-format.py for python3 compatibility

Summary:
D23319 introduced python3 compatibility to clang-format.py, this is however not 
reflected by the documentation in the comments at the beginning of the file, 
which show how to use the script with python2 in .vimrc. While the actual 
mapping a user might want to use may well differ from my suggestion, I think 
it's nice to show the python2 and python3 version, such that a user can pick 
from the suggestions instead of googeling the python3 replacement for `:pyf` 
which they might not be familiar with.

EDIT: picking reviewers according to 
https://llvm.org/docs/Phabricator.html#finding-potential-reviewers

Reviewers: klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: ilya-biryukov, cfe-commits, llvm-commits, ychen

Patch By: pseyfert

Tags: #clang-tools-extra, #llvm, #clang

Differential Revision: https://reviews.llvm.org/D38446

Added: 


Modified: 
clang/tools/clang-format/clang-format.py

Removed: 




diff  --git a/clang/tools/clang-format/clang-format.py 
b/clang/tools/clang-format/clang-format.py
index 0c772f91f6f2..976c222df055 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/tools/clang-format/clang-format.py
@@ -2,11 +2,19 @@
 # - Change 'binary' if clang-format is not on the path (see below).
 # - Add to your .vimrc:
 #
-#   map  :pyf /clang-format.py
-#   imap  :pyf /clang-format.py
+#   if has('python')
+# map  :pyf /clang-format.py
+# imap  :pyf /clang-format.py
+#   elseif has('python3')
+# map  :py3f /clang-format.py
+# imap  :py3f /clang-format.py
+#   endif
 #
-# The first line enables clang-format for NORMAL and VISUAL mode, the second
-# line adds support for INSERT mode. Change "C-I" to another binding if you
+# The if-elseif-endif conditional should pick either the python3 or python2 
+# integration depending on your vim setup.
+# 
+# The first mapping enables clang-format for NORMAL and VISUAL mode, the second
+# mapping adds support for INSERT mode. Change "C-I" to another binding if you
 # need clang-format on a 
diff erent key (C-I stands for Ctrl+i).
 #
 # With this integration you can press the bound key and clang-format will
@@ -20,7 +28,11 @@
 # like:
 # :function FormatFile()
 # :  let l:lines="all"
-# :  pyf /clang-format.py
+# :  if has('python')
+# :pyf /clang-format.py
+# :  elseif has('python3')
+# :py3f /clang-format.py
+# :  endif
 # :endfunction
 #
 # It operates on the current, potentially unsaved buffer and does not create



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69979: clang: Guess at some platform FTZ/DAZ default settings

2019-11-08 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added a comment.

In D69979#1738099 , @craig.topper 
wrote:

> I checked Redhat 7.4 that's on the server I'm using for work. And I had a 
> coworker check his Ubuntu 18.04 system with this program. And both systems 
> printed 1f80 as the value of MXCSR which shows FTZ and DAZ are both 0. Are 
> you seeing something different?


AFAIK, x86(-64) Linux is IEEE-compliant by default. It's only when compiling 
with -ffast-math that clang/gcc link in the startup routine to set FTZ/DAZ. So 
this patch should use that same mechanism to set the denorm mode. See: 
https://reviews.llvm.org/rL165240

@RKSimon - is it the same on PS4?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69979/new/

https://reviews.llvm.org/D69979



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38446: update comments in clang-format.py for python3 compatibility

2019-11-08 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6bf9e88ae4a4: [clang-format] update comments in 
clang-format.py for python3 compatibility (authored by MyDeveloperDay).

Changed prior to commit:
  https://reviews.llvm.org/D38446?vs=117280&id=228419#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D38446/new/

https://reviews.llvm.org/D38446

Files:
  clang/tools/clang-format/clang-format.py


Index: clang/tools/clang-format/clang-format.py
===
--- clang/tools/clang-format/clang-format.py
+++ clang/tools/clang-format/clang-format.py
@@ -2,11 +2,19 @@
 # - Change 'binary' if clang-format is not on the path (see below).
 # - Add to your .vimrc:
 #
-#   map  :pyf /clang-format.py
-#   imap  :pyf /clang-format.py
+#   if has('python')
+# map  :pyf /clang-format.py
+# imap  :pyf /clang-format.py
+#   elseif has('python3')
+# map  :py3f /clang-format.py
+# imap  :py3f /clang-format.py
+#   endif
 #
-# The first line enables clang-format for NORMAL and VISUAL mode, the second
-# line adds support for INSERT mode. Change "C-I" to another binding if you
+# The if-elseif-endif conditional should pick either the python3 or python2 
+# integration depending on your vim setup.
+# 
+# The first mapping enables clang-format for NORMAL and VISUAL mode, the second
+# mapping adds support for INSERT mode. Change "C-I" to another binding if you
 # need clang-format on a different key (C-I stands for Ctrl+i).
 #
 # With this integration you can press the bound key and clang-format will
@@ -20,7 +28,11 @@
 # like:
 # :function FormatFile()
 # :  let l:lines="all"
-# :  pyf /clang-format.py
+# :  if has('python')
+# :pyf /clang-format.py
+# :  elseif has('python3')
+# :py3f /clang-format.py
+# :  endif
 # :endfunction
 #
 # It operates on the current, potentially unsaved buffer and does not create


Index: clang/tools/clang-format/clang-format.py
===
--- clang/tools/clang-format/clang-format.py
+++ clang/tools/clang-format/clang-format.py
@@ -2,11 +2,19 @@
 # - Change 'binary' if clang-format is not on the path (see below).
 # - Add to your .vimrc:
 #
-#   map  :pyf /clang-format.py
-#   imap  :pyf /clang-format.py
+#   if has('python')
+# map  :pyf /clang-format.py
+# imap  :pyf /clang-format.py
+#   elseif has('python3')
+# map  :py3f /clang-format.py
+# imap  :py3f /clang-format.py
+#   endif
 #
-# The first line enables clang-format for NORMAL and VISUAL mode, the second
-# line adds support for INSERT mode. Change "C-I" to another binding if you
+# The if-elseif-endif conditional should pick either the python3 or python2 
+# integration depending on your vim setup.
+# 
+# The first mapping enables clang-format for NORMAL and VISUAL mode, the second
+# mapping adds support for INSERT mode. Change "C-I" to another binding if you
 # need clang-format on a different key (C-I stands for Ctrl+i).
 #
 # With this integration you can press the bound key and clang-format will
@@ -20,7 +28,11 @@
 # like:
 # :function FormatFile()
 # :  let l:lines="all"
-# :  pyf /clang-format.py
+# :  if has('python')
+# :pyf /clang-format.py
+# :  elseif has('python3')
+# :py3f /clang-format.py
+# :  endif
 # :endfunction
 #
 # It operates on the current, potentially unsaved buffer and does not create
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69962: [CFG] Fix a flaky crash in CFGBlock::getLastCondition().

2019-11-08 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added inline comments.



Comment at: clang/lib/Analysis/CFG.cpp:5882
 
+  // FIXME: Should we return the terminator here?
+  if (size() == 0)

What would that even be?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69962/new/

https://reviews.llvm.org/D69962



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 updated this revision to Diff 228421.
lh123 added a comment.

address comment


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996

Files:
  package.json
  src/semantic-highlighting.ts

Index: src/semantic-highlighting.ts
===
--- src/semantic-highlighting.ts
+++ src/semantic-highlighting.ts
@@ -114,17 +114,17 @@
 this.loadCurrentTheme();
 // Event handling for handling with TextDocuments/Editors lifetimes.
 this.subscriptions.push(vscode.window.onDidChangeVisibleTextEditors(
-(editors: vscode.TextEditor[]) =>
-editors.forEach((e) => this.highlighter.applyHighlights(
-e.document.uri.toString();
+(editors: vscode.TextEditor[]) => editors.forEach(
+(e) => this.highlighter.applyHighlights(e.document.uri;
 this.subscriptions.push(vscode.workspace.onDidCloseTextDocument(
-(doc) => this.highlighter.removeFileHighlightings(doc.uri.toString(;
+(doc) => this.highlighter.removeFileHighlightings(doc.uri)));
   }
 
   handleNotification(params: SemanticHighlightingParams) {
 const lines: SemanticHighlightingLine[] = params.lines.map(
 (line) => ({line : line.line, tokens : decodeTokens(line.tokens)}));
-this.highlighter.highlight(params.textDocument.uri, lines);
+this.highlighter.highlight(vscode.Uri.parse(params.textDocument.uri),
+   lines);
   }
   // Disposes of all disposable resources used by this object.
   public dispose() {
@@ -199,19 +199,21 @@
   // Adds incremental highlightings to the current highlightings for the file
   // with fileUri. Also applies the highlightings to any associated
   // TextEditor(s).
-  public highlight(fileUri: string,
+  public highlight(fileUri: vscode.Uri,
highlightingLines: SemanticHighlightingLine[]) {
-if (!this.files.has(fileUri)) {
-  this.files.set(fileUri, new Map());
+const fileUriStr = fileUri.toString();
+if (!this.files.has(fileUriStr)) {
+  this.files.set(fileUriStr, new Map());
 }
-const fileHighlightings = this.files.get(fileUri);
+const fileHighlightings = this.files.get(fileUriStr);
 highlightingLines.forEach((line) => fileHighlightings.set(line.line, line));
 this.applyHighlights(fileUri);
   }
 
   // Applies all the highlightings currently stored for a file with fileUri.
-  public applyHighlights(fileUri: string) {
-if (!this.files.has(fileUri))
+  public applyHighlights(fileUri: vscode.Uri) {
+const fileUriStr = fileUri.toString();
+if (!this.files.has(fileUriStr))
   // There are no highlightings for this file, must return early or will get
   // out of bounds when applying the decorations below.
   return;
@@ -224,7 +226,7 @@
 // TextEditorDecorationType is used per scope.
 const ranges = this.getDecorationRanges(fileUri);
 vscode.window.visibleTextEditors.forEach((e) => {
-  if (e.document.uri.toString() !== fileUri)
+  if (e.document.uri.toString() !== fileUriStr)
 return;
   this.decorationTypes.forEach((d, i) => e.setDecorations(d, ranges[i]));
 });
@@ -232,27 +234,27 @@
 
   // Called when a text document is closed. Removes any highlighting entries for
   // the text document that was closed.
-  public removeFileHighlightings(fileUri: string) {
+  public removeFileHighlightings(fileUri: vscode.Uri) {
 // If there exists no entry the call to delete just returns false.
-this.files.delete(fileUri);
+this.files.delete(fileUri.toString());
   }
 
   // Gets the uris as strings for the currently visible text editors.
-  protected getVisibleTextEditorUris(): string[] {
-return vscode.window.visibleTextEditors.map((e) =>
-e.document.uri.toString());
+  protected getVisibleTextEditorUris(): vscode.Uri[] {
+return vscode.window.visibleTextEditors.map((e) => e.document.uri);
   }
 
   // Returns the ranges that should be used when decorating. Index i in the
   // range array has the decoration type at index i of this.decorationTypes.
-  protected getDecorationRanges(fileUri: string): vscode.Range[][] {
-if (!this.files.has(fileUri))
+  protected getDecorationRanges(fileUri: vscode.Uri): vscode.Range[][] {
+const fileUriStr = fileUri.toString();
+if (!this.files.has(fileUriStr))
   // this.files should always have an entry for fileUri if we are here. But
   // if there isn't one we don't want to crash the extension. This is also
   // useful for tests.
   return [];
 const lines: SemanticHighlightingLine[] =
-Array.from(this.files.get(fileUri).values());
+Array.from(this.files.get(fileUriStr).values());
 const decorations: vscode.Range[][] = this.decorationTypes.map(() => []);
 lines.forEach((line) => {
   line.tokens.forEach((token) => {
In

[PATCH] D69996: [clangd] Fixed colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 marked 2 inline comments as done.
lh123 added inline comments.



Comment at: 
clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts:128
+this.highlighter.highlight(
+vscode.Uri.parse(params.textDocument.uri).toString(), lines);
   }

ilya-biryukov wrote:
> Could we accept a `URI` in the `highlight` (and similar function in 
> highlighting) instead and compare the URIs instead of strings in the 
> `Highlighter.applyHighlightings`?
> 
> i.e. in code:
> ```
>  fileUri : string;
>  if (e.document.uri.toString() !== fileUri) 
>return;
> ```
> Could instead be:
> ```
>  fileUri : Uri;
>  if (e.document.uri.toString() !== fileUri.toString()) 
>return;
> ```
> 
> 
> This should normalize accordingly and is generally safer and more readable 
> than passing around strings.
Yes, you are right, I will refactor it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59516: [analyzer] Add custom filter functions for GenericTaintChecker

2019-11-08 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus accepted this revision.
Szelethus added a comment.
This revision is now accepted and ready to land.

LGTM, provided that the inlines are addressed! Thanks!




Comment at: clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:102-103
   /// system call etc.
-  bool checkPre(const CallExpr *CE, CheckerContext &C) const;
+  bool checkPre(const CallExpr *CE, const FunctionDecl *FDecl, StringRef Name,
+CheckerContext &C) const;
 

I recall that the current thinking is preferring `CallEvent`, though leave this 
as-is for now, because @steakhal might already have it locally.



Comment at: clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp:105
 
   /// Add taint sources on a pre-visit.
+  bool addSourcesPre(const CallExpr *CE, const FunctionDecl *FDecl,

We might as well explain what the return value here means (and for the other 
functions too).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59516/new/

https://reviews.llvm.org/D59516



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69948: [Checkers] Added support for freopen to StreamChecker.

2019-11-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske updated this revision to Diff 228424.
balazske marked an inline comment as done.
balazske added a comment.

- Do not allow null stream to freopen.
- Added comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69948/new/

https://reviews.llvm.org/D69948

Files:
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
  clang/test/Analysis/stream.c

Index: clang/test/Analysis/stream.c
===
--- clang/test/Analysis/stream.c
+++ clang/test/Analysis/stream.c
@@ -20,6 +20,7 @@
 extern int feof(FILE *stream);
 extern int ferror(FILE *stream);
 extern int fileno(FILE *stream);
+extern FILE *freopen(const char *pathname, const char *mode, FILE *stream);
 
 void check_fread() {
   FILE *fp = tmpfile();
@@ -111,6 +112,13 @@
   fclose(p); // expected-warning {{Try to close a file Descriptor already closed. Cause undefined behaviour}}
 }
 
+void f_double_close_alias(void) {
+  FILE *p1 = fopen("foo", "r");
+  FILE *p2 = p1;
+  fclose(p1);
+  fclose(p2); // expected-warning {{Try to close a file Descriptor already closed. Cause undefined behaviour}}
+}
+
 void f_leak(int c) {
   FILE *p = fopen("foo.c", "r");
   if(c)
@@ -134,3 +142,34 @@
 void pr8081(FILE *stream, long offset, int whence) {
   fseek(stream, offset, whence);
 }
+
+void check_freopen_1() {
+  FILE *f1 = freopen("foo.c", "r", 0); // expected-warning {{Stream pointer might be NULL}}
+}
+
+void check_freopen_2() {
+  FILE *f1 = fopen("foo.c", "r");
+  if (f1) {
+FILE *f2 = freopen(0, "w", f1);
+if (f2) {
+  // Check if f1 and f2 point to the same stream.
+  fclose(f1);
+  fclose(f2); // expected-warning {{Try to close a file Descriptor already closed. Cause undefined behaviour}}
+} else {
+  // Open failed, f1 points now to an invalid stream but this condition is currently not checked.
+  rewind(f1);
+  rewind(f2); // expected-warning {{Stream pointer might be NULL}}
+}
+  }
+}
+
+void check_freopen_3() {
+  FILE *f1 = fopen("foo.c", "r");
+  if (f1) {
+// Unchecked result of freopen.
+// The f1 may be invalid after this call (not checked by the checker).
+freopen(0, "w", f1);
+rewind(f1);
+fclose(f1);
+  }
+}
Index: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -66,6 +66,7 @@
   {{"fopen"}, &StreamChecker::evalFopen},
   {{"tmpfile"}, &StreamChecker::evalFopen},
   {{"fclose", 1}, &StreamChecker::evalFclose},
+  {{"freopen", 3}, &StreamChecker::evalFreopen},
   {{"fread", 4},
std::bind(&StreamChecker::checkArgNullStream, _1, _2, _3, 3)},
   {{"fwrite", 4},
@@ -91,6 +92,7 @@
 
   void evalFopen(const CallEvent &Call, CheckerContext &C) const;
   void evalFclose(const CallEvent &Call, CheckerContext &C) const;
+  void evalFreopen(const CallEvent &Call, CheckerContext &C) const;
   void evalFseek(const CallEvent &Call, CheckerContext &C) const;
 
   void checkArgNullStream(const CallEvent &Call, CheckerContext &C,
@@ -166,6 +168,59 @@
 C.addTransition(State);
 }
 
+void StreamChecker::evalFreopen(const CallEvent &Call,
+CheckerContext &C) const {
+  ProgramStateRef State = C.getState();
+  SValBuilder &SValBuilder = C.getSValBuilder();
+  const LocationContext *LCtx = C.getPredecessor()->getLocationContext();
+  ConstraintManager &CM = C.getConstraintManager();
+  auto *CE = dyn_cast_or_null(Call.getOriginExpr());
+  if (!CE)
+return;
+
+  Optional StreamVal = Call.getArgSVal(2).getAs();
+  if (!StreamVal)
+return;
+
+  // Do not allow NULL as passed stream pointer.
+  // This is not specified in the man page but may crash on some system.
+  checkNullStream(*StreamVal, C, State);
+  // Check if error was generated.
+  if (C.isDifferent())
+return;
+
+  DefinedSVal RetVal =
+  SValBuilder.conjureSymbolVal(nullptr, CE, LCtx, C.blockCount())
+  .castAs();
+  SymbolRef RetSym = RetVal.getAsSymbol();
+  assert(RetSym && "RetVal must be a symbol here.");
+
+  SymbolRef StreamSym = StreamVal->getAsSymbol();
+
+  // Generate state for NULL return value.
+  // Set the passed stream to OpenFailed state.
+  ProgramStateRef StateRetNull =
+  State->BindExpr(CE, C.getLocationContext(), RetVal);
+  StateRetNull = CM.assume(StateRetNull, RetVal, false);
+  assert(StateRetNull && "Assumption on unconstrained value should not fail.");
+  StateRetNull =
+  StateRetNull->set(RetSym, StreamState::getOpenFailed());
+  if (StreamSym)
+StateRetNull =
+StateRetNull->set(StreamSym, StreamState::getOpenFailed());
+  C.addTransition(StateRetNull);
+
+  // Generate state for non-failed case.
+  // Return value is the passed stream pointer.
+  // The stream becomes opened regardless of what is was.
+  ProgramStateRef

[PATCH] D69948: [Checkers] Added support for freopen to StreamChecker.

2019-11-08 Thread Balázs Kéri via Phabricator via cfe-commits
balazske marked 2 inline comments as done.
balazske added a comment.

I am still not sure in the `auto` type, I did not see that way of `auto` usage 
often in clang code.




Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:176
+  const LocationContext *LCtx = C.getPredecessor()->getLocationContext();
+  ConstraintManager &CM = C.getConstraintManager();
+  auto *CE = dyn_cast_or_null(Call.getOriginExpr());

baloghadamsoftware wrote:
> The four lines above are typical cases for using auto, since the type is 
> duplicated in the line. See: 
> https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable
This is not totally clear if we can trust the pattern that at `auto X = 
Y.getXxx()` type of `X` will be `Xxx`.



Comment at: clang/test/Analysis/stream.c:120
+  fclose(p2); // expected-warning {{Try to close a file Descriptor already 
closed. Cause undefined behaviour}}
+}
+

baloghadamsoftware wrote:
> I wonder if this test belongs into this particular patch. It has nothing to 
> do with `freopen()`.
I wanted to see if "aliasing" works because it happens in the freopen tests 
too. Probably this test is not needed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69948/new/

https://reviews.llvm.org/D69948



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69937: [clangd] Use name of Macro to compute its SymbolID.

2019-11-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 updated this revision to Diff 228431.
usaxena95 added a comment.

Hopefully reverting unintended changes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69937/new/

https://reviews.llvm.org/D69937

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/AST.h
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp


Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -377,7 +377,7 @@
 Roles & static_cast(index::SymbolRole::Definition)))
 return true;
 
-  auto ID = getSymbolID(*Name, MI, SM);
+  auto ID = getSymbolID(Name->getName(), MI, SM);
   if (!ID)
 return true;
 
@@ -473,14 +473,14 @@
 // First, drop header guards. We can't identify these until EOF.
 for (const IdentifierInfo *II : IndexedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName(), MI, PP->getSourceManager()))
   if (MI->isUsedForHeaderGuard())
 Symbols.erase(*ID);
 }
 // Now increment refcounts.
 for (const IdentifierInfo *II : ReferencedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName(), MI, PP->getSourceManager()))
   IncRef(*ID);
 }
   }
Index: clang-tools-extra/clangd/CodeComplete.cpp
===
--- clang-tools-extra/clangd/CodeComplete.cpp
+++ clang-tools-extra/clangd/CodeComplete.cpp
@@ -492,7 +492,7 @@
 return clang::clangd::getSymbolID(R.Declaration);
   }
   case CodeCompletionResult::RK_Macro:
-return clang::clangd::getSymbolID(*R.Macro, R.MacroDefInfo, SM);
+return clang::clangd::getSymbolID(R.Macro->getName(), R.MacroDefInfo, SM);
   case CodeCompletionResult::RK_Keyword:
 return None;
   }
Index: clang-tools-extra/clangd/AST.h
===
--- clang-tools-extra/clangd/AST.h
+++ clang-tools-extra/clangd/AST.h
@@ -17,6 +17,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Lex/MacroInfo.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace clang {
 class SourceManager;
@@ -69,7 +70,7 @@
 /// macro (e.g. a change in definition offset can result in a different USR). 
We
 /// could change these semantics in the future by reimplementing this funcure
 /// (e.g. avoid USR for macros).
-llvm::Optional getSymbolID(const IdentifierInfo &II,
+llvm::Optional getSymbolID(const llvm::StringRef MacroName,
  const MacroInfo *MI,
  const SourceManager &SM);
 
Index: clang-tools-extra/clangd/AST.cpp
===
--- clang-tools-extra/clangd/AST.cpp
+++ clang-tools-extra/clangd/AST.cpp
@@ -203,13 +203,13 @@
   return SymbolID(USR);
 }
 
-llvm::Optional getSymbolID(const IdentifierInfo &II,
+llvm::Optional getSymbolID(const llvm::StringRef MacroName,
  const MacroInfo *MI,
  const SourceManager &SM) {
   if (MI == nullptr)
 return None;
   llvm::SmallString<128> USR;
-  if (index::generateUSRForMacro(II.getName(), MI->getDefinitionLoc(), SM, 
USR))
+  if (index::generateUSRForMacro(MacroName, MI->getDefinitionLoc(), SM, USR))
 return None;
   return SymbolID(USR);
 }


Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -377,7 +377,7 @@
 Roles & static_cast(index::SymbolRole::Definition)))
 return true;
 
-  auto ID = getSymbolID(*Name, MI, SM);
+  auto ID = getSymbolID(Name->getName(), MI, SM);
   if (!ID)
 return true;
 
@@ -473,14 +473,14 @@
 // First, drop header guards. We can't identify these until EOF.
 for (const IdentifierInfo *II : IndexedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName(), MI, PP->getSourceManager()))
   if (MI->isUsedForHeaderGuard())
 Symbols.erase(*ID);
 }
 // Now increment refcounts.
 for (const IdentifierInfo *II : ReferencedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName()

[PATCH] D69937: [clangd] Use name of Macro to compute its SymbolID.

2019-11-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 updated this revision to Diff 228430.
usaxena95 added a comment.

- [clangd] Store xref for Macros in ParsedAST.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69937/new/

https://reviews.llvm.org/D69937

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/AST.h
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/CollectMacros.h
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -2050,6 +2050,23 @@
 } // namespace ns
 int main() { [[^ns]]::Foo foo; }
   )cpp",
+
+  R"cpp(// Macros
+#define [[FOO]](x,y) (x + y)
+// FIXME: No references for nested macros.
+#define BAR(x,y,z) (FOO(x, y) * FOO(y, z))
+int main() {
+  int x = [[FOO]](1, 2);
+  int y = [[FOO]]([[FO^O]](x, 1), [[FOO]](1, 1));
+  int z = BAR(1, 2, 3);
+}
+#define FOO(x) (x + 1)
+  )cpp",
+
+  R"cpp(// Macros: Cursor on definition.
+#define [[F^OO]](x,y) (x + y)
+int main() { int x = [[FOO]](1, 2); }
+  )cpp",
   };
   for (const char *Test : Tests) {
 Annotations T(Test);
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -377,7 +377,7 @@
 Roles & static_cast(index::SymbolRole::Definition)))
 return true;
 
-  auto ID = getSymbolID(*Name, MI, SM);
+  auto ID = getSymbolID(Name->getName(), MI, SM);
   if (!ID)
 return true;
 
@@ -473,14 +473,14 @@
 // First, drop header guards. We can't identify these until EOF.
 for (const IdentifierInfo *II : IndexedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName(), MI, PP->getSourceManager()))
   if (MI->isUsedForHeaderGuard())
 Symbols.erase(*ID);
 }
 // Now increment refcounts.
 for (const IdentifierInfo *II : ReferencedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName(), MI, PP->getSourceManager()))
   IncRef(*ID);
 }
   }
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -21,6 +21,7 @@
 #include "index/Merge.h"
 #include "index/Relation.h"
 #include "index/SymbolCollector.h"
+#include "index/SymbolID.h"
 #include "index/SymbolLocation.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
@@ -47,6 +48,7 @@
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
 
 namespace clang {
 namespace clangd {
@@ -891,7 +893,20 @@
   }
   auto Loc = SM.getMacroArgExpandedLocation(
   getBeginningOfIdentifier(Pos, SM, AST.getASTContext().getLangOpts()));
-  // TODO: should we handle macros, too?
+
+  // Handle macros.
+  if (auto Macro = locateMacroAt(Loc, AST.getPreprocessor())) {
+if (auto MacroSID = getSymbolID(Macro->Name, Macro->Info, SM)) {
+  const auto &IDToRefs = AST.getMacros().MacroRefs;
+  auto Refs = IDToRefs.find(*MacroSID);
+  if (Refs != IDToRefs.end())
+Results.insert(Results.end(), Refs->second.begin(), Refs->second.end());
+}
+if (Results.size() > Limit)
+  Results.resize(Limit);
+return Results;
+  }
+
   // We also show references to the targets of using-decls, so we include
   // DeclRelation::Underlying.
   DeclRelationSet Relations = DeclRelation::TemplatePattern |
@@ -911,8 +926,7 @@
  MainFileRefs.end());
   for (const auto &Ref : MainFileRefs) {
 if (auto Range =
-getTokenRange(AST.getASTContext().getSourceManager(),
-  AST.getASTContext().getLangOpts(), Ref.Loc)) {
+getTokenRange(SM, AST.getASTContext().getLangOpts(), Ref.Loc)) {
   Location Result;
   Result.range = *Range;
   Result.uri = URIForFile::canonicalize(*MainFilePath, *MainFilePath);
Index: clang-tools-extra/clangd/CollectMacros.h
===
--- clang-tools-extra/clangd/CollectMacros.h
+++ clang-tools-extra/clangd/CollectMacros.h
@@ -9,10 +9,13 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTEDMACROS_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTE

[PATCH] D69292: Proposal to add -Wtautological-compare to -Wall

2019-11-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69292/new/

https://reviews.llvm.org/D69292



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69762: [Diagnostics] Try to improve warning message for -Wreturn-type

2019-11-08 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

I'd probably go with `"non-void %select{function|block|coroutine}0 does not 
return a value %select{|in all control paths}1"`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69762/new/

https://reviews.llvm.org/D69762



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69979: clang: Guess at some platform FTZ/DAZ default settings

2019-11-08 Thread Sanjay Patel via Phabricator via cfe-commits
spatel added a reviewer: cameron.mcinally.
spatel added a comment.

Also, I may have missed some discussions. Does this patch series replace the 
proposal to add instruction-level FMF for denorms?
http://lists.llvm.org/pipermail/llvm-dev/2019-September/135183.html

Ie, did we decide that a function-level attribute is good enough?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69979/new/

https://reviews.llvm.org/D69979



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70003: [clang-format] Ensure dump_format_style.py can generate ClangFormatStyleOptions.rst without manual intervention

2019-11-08 Thread Mitchell via Phabricator via cfe-commits
mitchell-stellar accepted this revision.
mitchell-stellar added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70003/new/

https://reviews.llvm.org/D70003



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69800: [AArch64][SVE] Implement remaining floating-point arithmetic intrinsics

2019-11-08 Thread Sander de Smalen via Phabricator via cfe-commits
sdesmalen accepted this revision.
sdesmalen added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: llvm/test/CodeGen/AArch64/sve-intrinsics-fp-arith.ll:767
 ;
-; FSCALE
+; FNEG
 ;

kmclaughlin wrote:
> sdesmalen wrote:
> > Why are you moving this test and changing fscale -> fneg here?
> The rest of the tests here are in order and I noticed that fscale was in the 
> wrong place, so I moved it further down.
Okay, thanks for clarifying.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69800/new/

https://reviews.llvm.org/D69800



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69951: [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst

2019-11-08 Thread Mitchell via Phabricator via cfe-commits
mitchell-stellar added inline comments.



Comment at: clang/include/clang/Format/Format.h:1309
 
+  // clang-format off
   /// Indent case labels one level from the switch statement.

Can this documentation be formatted in a way that avoids clang-format 
reformatting it? It doesn't look like it depends on long lines like the other 
bits in this change.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69951/new/

https://reviews.llvm.org/D69951



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69951: [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst

2019-11-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay marked an inline comment as done.
MyDeveloperDay added inline comments.



Comment at: clang/include/clang/Format/Format.h:1309
 
+  // clang-format off
   /// Indent case labels one level from the switch statement.

mitchell-stellar wrote:
> Can this documentation be formatted in a way that avoids clang-format 
> reformatting it? It doesn't look like it depends on long lines like the other 
> bits in this change.
It's this line..

it turns:

```
When ``false``, use the same indentation level as for the switch statement.
Switch statement body is always indented one level more than case labels.
```

into:

```
When ``false``, use the same indentation level as for the switch
statement. Switch statement body is always indented one level more than
case labels.
```

My assumption was that the author wanted the "Switch statement.." to be a new 
paragraph, but if we don't mind then we could lose this one


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69951/new/

https://reviews.llvm.org/D69951



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixes colon escaping on Windows

2019-11-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!
Should I land this patch for you?

If you don't have commit access yet, you could consider applying to get one 
.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] eb00839 - [clang-format] Ensure dump_format_style.py can generate ClangFormatStyleOptions.rst without manual intervention

2019-11-08 Thread via cfe-commits

Author: paul_hoad
Date: 2019-11-08T14:40:36Z
New Revision: eb00839c6eb4f5dc6adadc83be93f32bd6143362

URL: 
https://github.com/llvm/llvm-project/commit/eb00839c6eb4f5dc6adadc83be93f32bd6143362
DIFF: 
https://github.com/llvm/llvm-project/commit/eb00839c6eb4f5dc6adadc83be93f32bd6143362.diff

LOG: [clang-format] Ensure dump_format_style.py can generate 
ClangFormatStyleOptions.rst without manual intervention

Summary:
This revision is the last in a series of revisions to return 
`clang/doc/tools/dump_format_style.py` to be being able to parse Format.h 
without needing to manually merge the ClangFormatStyleOptions.rst file.

The final modification to dump_format_style.py is needed following the addition 
of a  nested enumeration inside a nested structure following the introduction 
of {D68296}

Prior  related revisions will allow for a fully clang-formatted 
`clang/include/clang/Format/Format.h` to once again be used at the source.
{D69951}
{D69433}
{D69404}

Reviewers: mitchell-stellar, klimek, sammccall, owenpan

Reviewed By: mitchell-stellar

Subscribers: cfe-commits

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D70003

Added: 


Modified: 
clang/docs/ClangFormatStyleOptions.rst
clang/docs/tools/dump_format_style.py

Removed: 




diff  --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 1f915c346887..655923db9bc3 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -819,6 +819,7 @@ the configuration (without a prefix: ``Auto``).
 for (int i = 0; i < 10; ++i)
 {}
 
+
   * ``bool AfterEnum`` Wrap enum definitions.
 
 .. code-block:: c++

diff  --git a/clang/docs/tools/dump_format_style.py 
b/clang/docs/tools/dump_format_style.py
index db65e6e65b1c..acb0dfcaf4a7 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -77,6 +77,20 @@ def __init__(self, name, comment):
   def __str__(self):
 return '\n'.join(map(str, self.values))
 
+class NestedEnum(object):
+  def __init__(self, name, enumtype, comment, values):
+self.name = name
+self.comment = comment
+self.values = values
+self.type = enumtype
+
+  def __str__(self):
+s = '\n* ``%s %s``\n%s' % (self.type, self.name,
+ doxygen2rst(indent(self.comment, 2)))
+s += indent('\nPossible values:\n\n', 2)
+s += indent('\n'.join(map(str, self.values)),2)
+return s;
+
 class EnumValue(object):
   def __init__(self, name, comment, config):
 self.name = name
@@ -156,7 +170,12 @@ class State(object):
 comment += clean_comment_line(line)
   else:
 state = State.InNestedStruct
-nested_struct.values.append(NestedField(line.replace(';', ''), 
comment))
+field_type, field_name = 
re.match(r'([<>:\w(,\s)]+)\s+(\w+);',line).groups()
+if field_type in enums:
+
nested_struct.values.append(NestedEnum(field_name,field_type,comment,enums[field_type].values))
+else:
+nested_struct.values.append(NestedField(field_type + " " + 
field_name, comment))
+
 elif state == State.InEnum:
   if line.startswith('///'):
 state = State.InEnumMemberComment



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70003: [clang-format] Ensure dump_format_style.py can generate ClangFormatStyleOptions.rst without manual intervention

2019-11-08 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGeb00839c6eb4: [clang-format] Ensure dump_format_style.py can 
generate ClangFormatStyleOptions. (authored by paul_hoad 
).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70003/new/

https://reviews.llvm.org/D70003

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/tools/dump_format_style.py


Index: clang/docs/tools/dump_format_style.py
===
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -77,6 +77,20 @@
   def __str__(self):
 return '\n'.join(map(str, self.values))
 
+class NestedEnum(object):
+  def __init__(self, name, enumtype, comment, values):
+self.name = name
+self.comment = comment
+self.values = values
+self.type = enumtype
+
+  def __str__(self):
+s = '\n* ``%s %s``\n%s' % (self.type, self.name,
+ doxygen2rst(indent(self.comment, 2)))
+s += indent('\nPossible values:\n\n', 2)
+s += indent('\n'.join(map(str, self.values)),2)
+return s;
+
 class EnumValue(object):
   def __init__(self, name, comment, config):
 self.name = name
@@ -156,7 +170,12 @@
 comment += clean_comment_line(line)
   else:
 state = State.InNestedStruct
-nested_struct.values.append(NestedField(line.replace(';', ''), 
comment))
+field_type, field_name = 
re.match(r'([<>:\w(,\s)]+)\s+(\w+);',line).groups()
+if field_type in enums:
+
nested_struct.values.append(NestedEnum(field_name,field_type,comment,enums[field_type].values))
+else:
+nested_struct.values.append(NestedField(field_type + " " + 
field_name, comment))
+
 elif state == State.InEnum:
   if line.startswith('///'):
 state = State.InEnumMemberComment
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -819,6 +819,7 @@
 for (int i = 0; i < 10; ++i)
 {}
 
+
   * ``bool AfterEnum`` Wrap enum definitions.
 
 .. code-block:: c++


Index: clang/docs/tools/dump_format_style.py
===
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -77,6 +77,20 @@
   def __str__(self):
 return '\n'.join(map(str, self.values))
 
+class NestedEnum(object):
+  def __init__(self, name, enumtype, comment, values):
+self.name = name
+self.comment = comment
+self.values = values
+self.type = enumtype
+
+  def __str__(self):
+s = '\n* ``%s %s``\n%s' % (self.type, self.name,
+ doxygen2rst(indent(self.comment, 2)))
+s += indent('\nPossible values:\n\n', 2)
+s += indent('\n'.join(map(str, self.values)),2)
+return s;
+
 class EnumValue(object):
   def __init__(self, name, comment, config):
 self.name = name
@@ -156,7 +170,12 @@
 comment += clean_comment_line(line)
   else:
 state = State.InNestedStruct
-nested_struct.values.append(NestedField(line.replace(';', ''), comment))
+field_type, field_name = re.match(r'([<>:\w(,\s)]+)\s+(\w+);',line).groups()
+if field_type in enums:
+nested_struct.values.append(NestedEnum(field_name,field_type,comment,enums[field_type].values))
+else:
+nested_struct.values.append(NestedField(field_type + " " + field_name, comment))
+
 elif state == State.InEnum:
   if line.startswith('///'):
 state = State.InEnumMemberComment
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -819,6 +819,7 @@
 for (int i = 0; i < 10; ++i)
 {}
 
+
   * ``bool AfterEnum`` Wrap enum definitions.
 
 .. code-block:: c++
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69951: [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst

2019-11-08 Thread Mitchell via Phabricator via cfe-commits
mitchell-stellar added inline comments.



Comment at: clang/include/clang/Format/Format.h:1309
 
+  // clang-format off
   /// Indent case labels one level from the switch statement.

MyDeveloperDay wrote:
> mitchell-stellar wrote:
> > Can this documentation be formatted in a way that avoids clang-format 
> > reformatting it? It doesn't look like it depends on long lines like the 
> > other bits in this change.
> It's this line..
> 
> it turns:
> 
> ```
> When ``false``, use the same indentation level as for the switch statement.
> Switch statement body is always indented one level more than case labels.
> ```
> 
> into:
> 
> ```
> When ``false``, use the same indentation level as for the switch
> statement. Switch statement body is always indented one level more than
> case labels.
> ```
> 
> My assumption was that the author wanted the "Switch statement.." to be a new 
> paragraph, but if we don't mind then we could lose this one
The HTML is no different. If the author wanted a separate paragraph, I suspect 
that person would have used two line breaks. I would reformat this one and 
remove the clang-format switches.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69951/new/

https://reviews.llvm.org/D69951



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69996: [clangd] Fixes colon escaping on Windows

2019-11-08 Thread liu hui via Phabricator via cfe-commits
lh123 added a comment.

Thanks for your reminder, I have sent an email to apply for commit access, but 
I don't know how long it will take.

> Should I land this patch for you?

Yes, you can land this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69996/new/

https://reviews.llvm.org/D69996



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70008: [clangd] Store xref for Macros in ParsedAST.

2019-11-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 added a comment.

Please ignore the changes from patch https://reviews.llvm.org/D69937
Will fix this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70008/new/

https://reviews.llvm.org/D70008



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70008: [clangd] Store xref for Macros in ParsedAST.

2019-11-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 created this revision.
usaxena95 added a reviewer: hokein.
usaxena95 added a project: clang.

This patch adds the cross references for Macros in the MainFile.
We add references for the main file to the ParsedAST. We query the
references from it using the SymbolID.
Xref outside main file will be added to the index in a separate patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70008

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/AST.h
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/CollectMacros.h
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/index/SymbolCollector.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -2050,6 +2050,23 @@
 } // namespace ns
 int main() { [[^ns]]::Foo foo; }
   )cpp",
+
+  R"cpp(// Macros
+#define [[FOO]](x,y) (x + y)
+// FIXME: No references for nested macros.
+#define BAR(x,y,z) (FOO(x, y) * FOO(y, z))
+int main() {
+  int x = [[FOO]](1, 2);
+  int y = [[FOO]]([[FO^O]](x, 1), [[FOO]](1, 1));
+  int z = BAR(1, 2, 3);
+}
+#define FOO(x) (x + 1)
+  )cpp",
+
+  R"cpp(// Macros: Cursor on definition.
+#define [[F^OO]](x,y) (x + y)
+int main() { int x = [[FOO]](1, 2); }
+  )cpp",
   };
   for (const char *Test : Tests) {
 Annotations T(Test);
Index: clang-tools-extra/clangd/index/SymbolCollector.cpp
===
--- clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -377,7 +377,7 @@
 Roles & static_cast(index::SymbolRole::Definition)))
 return true;
 
-  auto ID = getSymbolID(*Name, MI, SM);
+  auto ID = getSymbolID(Name->getName(), MI, SM);
   if (!ID)
 return true;
 
@@ -473,14 +473,14 @@
 // First, drop header guards. We can't identify these until EOF.
 for (const IdentifierInfo *II : IndexedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName(), MI, PP->getSourceManager()))
   if (MI->isUsedForHeaderGuard())
 Symbols.erase(*ID);
 }
 // Now increment refcounts.
 for (const IdentifierInfo *II : ReferencedMacros) {
   if (const auto *MI = PP->getMacroDefinition(II).getMacroInfo())
-if (auto ID = getSymbolID(*II, MI, PP->getSourceManager()))
+if (auto ID = getSymbolID(II->getName(), MI, PP->getSourceManager()))
   IncRef(*ID);
 }
   }
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -21,6 +21,7 @@
 #include "index/Merge.h"
 #include "index/Relation.h"
 #include "index/SymbolCollector.h"
+#include "index/SymbolID.h"
 #include "index/SymbolLocation.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
@@ -47,6 +48,7 @@
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
 
 namespace clang {
 namespace clangd {
@@ -891,7 +893,20 @@
   }
   auto Loc = SM.getMacroArgExpandedLocation(
   getBeginningOfIdentifier(Pos, SM, AST.getASTContext().getLangOpts()));
-  // TODO: should we handle macros, too?
+
+  // Handle macros.
+  if (auto Macro = locateMacroAt(Loc, AST.getPreprocessor())) {
+if (auto MacroSID = getSymbolID(Macro->Name, Macro->Info, SM)) {
+  const auto &IDToRefs = AST.getMacros().MacroRefs;
+  auto Refs = IDToRefs.find(*MacroSID);
+  if (Refs != IDToRefs.end())
+Results.insert(Results.end(), Refs->second.begin(), Refs->second.end());
+}
+if (Results.size() > Limit)
+  Results.resize(Limit);
+return Results;
+  }
+
   // We also show references to the targets of using-decls, so we include
   // DeclRelation::Underlying.
   DeclRelationSet Relations = DeclRelation::TemplatePattern |
@@ -911,8 +926,7 @@
  MainFileRefs.end());
   for (const auto &Ref : MainFileRefs) {
 if (auto Range =
-getTokenRange(AST.getASTContext().getSourceManager(),
-  AST.getASTContext().getLangOpts(), Ref.Loc)) {
+getTokenRange(SM, AST.getASTContext().getLangOpts(), Ref.Loc)) {
   Location Result;
   Result.range = *Range;
   Result.uri = URIForFile::canonicalize(*MainFilePath, *MainFilePath);
Index: clang-tools-extra/clangd/CollectMacros.h
===
--- clang-tools-extra/clangd/CollectMacros.h
+++ clang-

[libclc] 00eca0b - libclc: Drop travis

2019-11-08 Thread Jan Vesely via cfe-commits

Author: Jan Vesely
Date: 2019-11-08T09:58:27-05:00
New Revision: 00eca0bf0bd9a70735a4d6d39ab3776c858d915c

URL: 
https://github.com/llvm/llvm-project/commit/00eca0bf0bd9a70735a4d6d39ab3776c858d915c
DIFF: 
https://github.com/llvm/llvm-project/commit/00eca0bf0bd9a70735a4d6d39ab3776c858d915c.diff

LOG: libclc: Drop travis

It only works for standalone repos.

Reviewer: tstellar
Differential Revision: https://reviews.llvm.org/D69965

Added: 


Modified: 


Removed: 
libclc/.travis.yml



diff  --git a/libclc/.travis.yml b/libclc/.travis.yml
deleted file mode 100644
index e8a41d98d83a..
--- a/libclc/.travis.yml
+++ /dev/null
@@ -1,200 +0,0 @@
-language: cpp
-
-dist: xenial
-
-matrix:
-  include:
-- env:
-- LABEL="make gcc LLVM-3.9"
-- LLVM_VERSION=3.9
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc 
nvptx64--nvidiacl.bc"
-  addons:
-apt:
-  packages:
-- llvm-3.9-dev
-- clang-3.9
-- env:
-- LABEL="make gcc LLVM-4.0"
-- LLVM_VERSION=4.0
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
-  addons:
-apt:
-  packages:
-- llvm-4.0-dev
-- clang-4.0
-- env:
-- LABEL="make gcc LLVM-5.0"
-- LLVM_VERSION=5.0
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
-  addons:
-apt:
-  packages:
-- llvm-5.0-dev
-- clang-5.0
-- env:
-- LABEL="make gcc LLVM-6.0"
-- LLVM_VERSION=6.0
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
-  addons:
-apt:
-  packages:
-- llvm-6.0-dev
-- clang-6.0
-- env:
-- LABEL="make gcc LLVM-7"
-- LLVM_VERSION=7
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
-# llvm passes -Werror=date-time which is only supported in gcc-4.9+
-- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
-  addons:
-apt:
-  sources:
-- sourceline: 'deb http://apt.llvm.org/xenial/ 
llvm-toolchain-xenial-7 main'
-  key_url: https://apt.llvm.org/llvm-snapshot.gpg.key
-- ubuntu-toolchain-r-test
-  packages:
-- libedit-dev
-- g++-6
-# From sources above
-- llvm-7-dev
-- clang-7
-- env:
-- LABEL="make gcc LLVM-8"
-- LLVM_VERSION=8
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
-# llvm passes -Werror=date-time which is only supported in gcc-4.9+
-- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
-  addons:
-apt:
-  sources:
-- sourceline: 'deb http://apt.llvm.org/xenial/ 
llvm-toolchain-xenial-8 main'
-  key_url: https://apt.llvm.org/llvm-snapshot.gpg.key
-- ubuntu-toolchain-r-test
-  packages:
-- libedit-dev
-- g++-6
-# From sources above
-- llvm-8-dev
-- clang-8
-- env:
-- LABEL="make gcc LLVM-9"
-- LLVM_VERSION=9
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc 
tahiti-amdgcn-mesa-mesa3d.bc nvptx--nvidiacl.bc nvptx64--nvidiacl.bc"
-- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
-  addons:
-apt:
-  sources:
-- sourceline: 'deb http://apt.llvm.org/xenial/ 
llvm-toolchain-xenial-9 main'
-  key_url: https://apt.llvm.org/llvm-snapshot.gpg.key
-- ubuntu-toolchain-r-test
-  packages:
-- libedit-dev
-- g++-6
-# From sources above
-- llvm-9-dev
-- clang-9
-- env:
-- LABEL="cmake gcc LLVM-3.9"
-- LLVM_VERSION=3.9
-- CHECK_FILES="barts-r600--.bc cayman-r600--.bc cedar-r600--.bc 
cypress-r600--.bc tahiti-amdgcn--.bc amdgcn--amdhsa.bc nvptx--nvidiacl.bc 
nvptx64--nvidiacl.bc"
-  addons:
-apt:
-  packages:
-- llvm-3.9-dev
-- clang-3.9
-- env:
-- LABEL="cmake gcc LLV

[PATCH] D69951: [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst

2019-11-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay marked an inline comment as done.
MyDeveloperDay added inline comments.



Comment at: clang/include/clang/Format/Format.h:1309
 
+  // clang-format off
   /// Indent case labels one level from the switch statement.

mitchell-stellar wrote:
> MyDeveloperDay wrote:
> > mitchell-stellar wrote:
> > > Can this documentation be formatted in a way that avoids clang-format 
> > > reformatting it? It doesn't look like it depends on long lines like the 
> > > other bits in this change.
> > It's this line..
> > 
> > it turns:
> > 
> > ```
> > When ``false``, use the same indentation level as for the switch statement.
> > Switch statement body is always indented one level more than case labels.
> > ```
> > 
> > into:
> > 
> > ```
> > When ``false``, use the same indentation level as for the switch
> > statement. Switch statement body is always indented one level more than
> > case labels.
> > ```
> > 
> > My assumption was that the author wanted the "Switch statement.." to be a 
> > new paragraph, but if we don't mind then we could lose this one
> The HTML is no different. If the author wanted a separate paragraph, I 
> suspect that person would have used two line breaks. I would reformat this 
> one and remove the clang-format switches.
Sounds good, you are quite correct, the text is all on the same line anyway

{F10666589}





CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69951/new/

https://reviews.llvm.org/D69951



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69951: [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst

2019-11-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 228446.
MyDeveloperDay added a comment.

remove one set of // clang-format on/off that has no visual impact to the html

NOTE: it does change the baseline .rst which is why its been added into the 
review.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69951/new/

https://reviews.llvm.org/D69951

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h

Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -1161,6 +1161,7 @@
   /// \endcode
   bool CompactNamespaces;
 
+  // clang-format off
   /// If the constructor initializers don't fit on a line, put each
   /// initializer on its own line.
   /// \code
@@ -1178,6 +1179,7 @@
   ///   }
   /// \endcode
   bool ConstructorInitializerAllOnOneLineOrOnePerLine;
+  // clang-format on
 
   /// The number of characters to use for indentation of constructor
   /// initializer lists as well as inheritance lists.
@@ -1306,9 +1308,9 @@
 
   /// Indent case labels one level from the switch statement.
   ///
-  /// When ``false``, use the same indentation level as for the switch statement.
-  /// Switch statement body is always indented one level more than case labels.
-  /// \code
+  /// When ``false``, use the same indentation level as for the switch
+  /// statement. Switch statement body is always indented one level more than
+  /// case labels. \code
   ///false: true:
   ///switch (fool) {vs. switch (fool) {
   ///case 1:  case 1:
@@ -1453,6 +1455,7 @@
   /// The JavaScriptQuoteStyle to use for JavaScript strings.
   JavaScriptQuoteStyle JavaScriptQuotes;
 
+  // clang-format off
   /// Whether to wrap JavaScript import/export statements.
   /// \code{.js}
   ///true:
@@ -1466,6 +1469,7 @@
   ///import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,} from "some/module.js"
   /// \endcode
   bool JavaScriptWrapImports;
+  // clang-format on
 
   /// If true, the empty line at the start of blocks is kept.
   /// \code
@@ -1747,6 +1751,7 @@
   /// \endcode
   std::vector RawStringFormats;
 
+  // clang-format off
   /// If ``true``, clang-format will attempt to re-flow comments.
   /// \code
   ///false:
@@ -1760,6 +1765,7 @@
   /// * information */
   /// \endcode
   bool ReflowComments;
+  // clang-format on
 
   /// If ``true``, clang-format will sort ``#includes``.
   /// \code
@@ -2294,8 +2300,7 @@
 /// a non-recoverable syntax error.
 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
ArrayRef Ranges,
-   StringRef FileName,
-   bool *IncompleteFormat);
+   StringRef FileName, bool *IncompleteFormat);
 
 /// Clean up any erroneous/redundant code in the given \p Ranges in \p
 /// Code.
@@ -2406,6 +2411,6 @@
 namespace std {
 template <>
 struct is_error_code_enum : std::true_type {};
-}
+} // namespace std
 
 #endif // LLVM_CLANG_FORMAT_FORMAT_H
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -1584,11 +1584,9 @@
 **IndentCaseLabels** (``bool``)
   Indent case labels one level from the switch statement.
 
-  When ``false``, use the same indentation level as for the switch statement.
-  Switch statement body is always indented one level more than case labels.
-
-  .. code-block:: c++
-
+  When ``false``, use the same indentation level as for the switch
+  statement. Switch statement body is always indented one level more than
+  case labels. \code
  false: true:
  switch (fool) {vs. switch (fool) {
  case 1:  case 1:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69204: [OpenMP 5.0] - Extend defaultmap

2019-11-08 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/lib/Sema/SemaOpenMP.cpp:4435-4437
+if (DMIB == DMIB_alloc) Kind = OMPC_MAP_alloc;
+else if (DMIB == DMIB_to) Kind = OMPC_MAP_to;
+else if (DMIB == DMIB_from) Kind = OMPC_MAP_from;

cchen wrote:
> ABataev wrote:
> > Use `switch`
> In this switch statement, I checked if the implicit map contains any "declare 
> target link" to prove that for the normal case (no declare target link/to), 
> DMIB_default and DMIB_default is unreachable for scalar and pointer.
> However, this change is not quite right since I haven't added any extra 
> ImplicitMap to deal with the case that ImplicitMap contains "declare target 
> link" variable. (instead, I only create an extra field in ImplicitMap only so 
> that I can demonstrate) And the reason why I'm hesitant to do so is that 
> adding another two ImplicitMap only for "declare target link" might be a 
> little be overkill?
Then, I think, you just use the wrong key for the implicit mapping. You're 
using the kind of the mapped data (scalar, pointer or aggregate), instead used 
kind of mapping as the key. It means, that you need to have not 3 arrays but 
arrays for firstprivates, tofrom, to, from, alloc, etc. And all this processing 
must be in one place, in the class.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69204/new/

https://reviews.llvm.org/D69204



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69922: [OpenMP] Use the OpenMP-IR-Builder

2019-11-08 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/test/OpenMP/barrier_codegen.cpp:22
+// CLANGCG-NOT: readonly
+// IRBUILDER:  ; Function Attrs: nofree nosync nounwind readonly
+// IRBUILDER-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*)

Not sure about correct use of `nosync` and `readonly` attributes. OpenMP 
runtime uses lazy initialization of the runtime library and when any runtime 
function is called, the inner parts of the OpenMP runtime are initialized 
automatically. It may use some sync primitives and may modify memory, I assume. 
Same about `nofree`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69922/new/

https://reviews.llvm.org/D69922



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D70008: [clangd] Store xref for Macros in ParsedAST.

2019-11-08 Thread UTKARSH SAXENA via Phabricator via cfe-commits
usaxena95 updated this revision to Diff 228456.
usaxena95 added a comment.

Removing changes from different patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70008/new/

https://reviews.llvm.org/D70008

Files:
  clang-tools-extra/clangd/AST.cpp
  clang-tools-extra/clangd/CodeComplete.cpp
  clang-tools-extra/clangd/CollectMacros.h
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp

Index: clang-tools-extra/clangd/unittests/XRefsTests.cpp
===
--- clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -2050,6 +2050,23 @@
 } // namespace ns
 int main() { [[^ns]]::Foo foo; }
   )cpp",
+
+  R"cpp(// Macros
+#define [[FOO]](x,y) (x + y)
+// FIXME: No references for nested macros.
+#define BAR(x,y,z) (FOO(x, y) * FOO(y, z))
+int main() {
+  int x = [[FOO]](1, 2);
+  int y = [[FOO]]([[FO^O]](x, 1), [[FOO]](1, 1));
+  int z = BAR(1, 2, 3);
+}
+#define FOO(x) (x + 1)
+  )cpp",
+
+  R"cpp(// Macros: Cursor on definition.
+#define [[F^OO]](x,y) (x + y)
+int main() { int x = [[FOO]](1, 2); }
+  )cpp",
   };
   for (const char *Test : Tests) {
 Annotations T(Test);
Index: clang-tools-extra/clangd/XRefs.cpp
===
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -21,6 +21,7 @@
 #include "index/Merge.h"
 #include "index/Relation.h"
 #include "index/SymbolCollector.h"
+#include "index/SymbolID.h"
 #include "index/SymbolLocation.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
@@ -47,6 +48,7 @@
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
+#include 
 
 namespace clang {
 namespace clangd {
@@ -891,7 +893,20 @@
   }
   auto Loc = SM.getMacroArgExpandedLocation(
   getBeginningOfIdentifier(Pos, SM, AST.getASTContext().getLangOpts()));
-  // TODO: should we handle macros, too?
+
+  // Handle macros.
+  if (auto Macro = locateMacroAt(Loc, AST.getPreprocessor())) {
+if (auto MacroSID = getSymbolID(Macro->Name, Macro->Info, SM)) {
+  const auto &IDToRefs = AST.getMacros().MacroRefs;
+  auto Refs = IDToRefs.find(*MacroSID);
+  if (Refs != IDToRefs.end())
+Results.insert(Results.end(), Refs->second.begin(), Refs->second.end());
+}
+if (Results.size() > Limit)
+  Results.resize(Limit);
+return Results;
+  }
+
   // We also show references to the targets of using-decls, so we include
   // DeclRelation::Underlying.
   DeclRelationSet Relations = DeclRelation::TemplatePattern |
@@ -911,8 +926,7 @@
  MainFileRefs.end());
   for (const auto &Ref : MainFileRefs) {
 if (auto Range =
-getTokenRange(AST.getASTContext().getSourceManager(),
-  AST.getASTContext().getLangOpts(), Ref.Loc)) {
+getTokenRange(SM, AST.getASTContext().getLangOpts(), Ref.Loc)) {
   Location Result;
   Result.range = *Range;
   Result.uri = URIForFile::canonicalize(*MainFilePath, *MainFilePath);
Index: clang-tools-extra/clangd/CollectMacros.h
===
--- clang-tools-extra/clangd/CollectMacros.h
+++ clang-tools-extra/clangd/CollectMacros.h
@@ -9,10 +9,13 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTEDMACROS_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_COLLECTEDMACROS_H
 
+#include "AST.h"
 #include "Protocol.h"
 #include "SourceCode.h"
+#include "index/SymbolID.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Lex/PPCallbacks.h"
+#include "llvm/ADT/DenseMap.h"
 #include 
 
 namespace clang {
@@ -23,6 +26,7 @@
   // Instead of storing SourceLocation, we have to store the token range because
   // SourceManager from preamble is not available when we build the AST.
   std::vector Ranges;
+  llvm::DenseMap> MacroRefs;
 };
 
 /// Collects macro references (e.g. definitions, expansions) in the main file.
@@ -39,6 +43,12 @@
   void FileChanged(SourceLocation Loc, FileChangeReason,
SrcMgr::CharacteristicKind, FileID) override {
 InMainFile = isInsideMainFile(Loc, SM);
+if (InMainFile) {
+  auto MainFilePath =
+  getCanonicalPath(SM.getFileEntryForID(SM.getMainFileID()), SM);
+  if (MainFilePath)
+MainFileURI = URIForFile::canonicalize(*MainFilePath, *MainFilePath);
+}
   }
 
   void MacroDefined(const Token &MacroName, const MacroDirective *MD) override {
@@ -82,9 +92,17 @@
 if (auto Range = getTokenRange(SM, LangOpts, Loc)) {
   Out.Names.insert(MacroNameTok.getIdentifierInfo()->getName());
   Out.Ranges.push_back(*Range);
+  if (auto SID = getSymbolID(MacroNameTok.getIdentifierInfo()->getName(),
+ 

[PATCH] D69785: [OpenMP] Introduce the OpenMP-IR-Builder

2019-11-08 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: llvm/lib/IR/OpenMPIRBuilder.cpp:153-159
+// Search the entry block, not needed once all thread id calls go through
+// here and are cached in the OpenMPIRBuilder.
+for (Instruction &I : Fn->getEntryBlock())
+  if (CallInst *CI = dyn_cast(&I))
+if (CI->getCalledFunction() &&
+CI->getCalledFunction()->getName() == "__kmpc_global_thread_num")
+  return TID = CI;

Do you really need this if you have a deduplication pass?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69785/new/

https://reviews.llvm.org/D69785



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 2073dd2 - Redeclare Objective-C property accessors inside the ObjCImplDecl in which they are synthesized.

2019-11-08 Thread Adrian Prantl via cfe-commits

Author: Adrian Prantl
Date: 2019-11-08T08:23:22-08:00
New Revision: 2073dd2da702baca447efaf1879cb6151e8c6100

URL: 
https://github.com/llvm/llvm-project/commit/2073dd2da702baca447efaf1879cb6151e8c6100
DIFF: 
https://github.com/llvm/llvm-project/commit/2073dd2da702baca447efaf1879cb6151e8c6100.diff

LOG: Redeclare Objective-C property accessors inside the ObjCImplDecl in which 
they are synthesized.

This patch is motivated by (and factored out from)
https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting
with DWARF 5 all Objective-C methods are nested inside their
containing type, and that patch implements this for synthesized
Objective-C properties.

1. SemaObjCProperty populates a list of synthesized accessors that may
   need to inserted into an ObjCImplDecl.

2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all
   accessors for which no override was provided into their
   ObjCImplDecl. This patch does *not* synthesize AST function
   *bodies*. Moving that code from the static analyzer into Sema may
   be a good idea though.

3. Places that expect all methods to have bodies have been updated.

I did not update the static analyzer's inliner for synthesized
properties to point back to the property declaration (see
test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which
I believed to be more bug than a feature.

Differential Revision: https://reviews.llvm.org/D68108

rdar://problem/53782400

Added: 


Modified: 
clang/include/clang/AST/DeclBase.h
clang/include/clang/AST/DeclObjC.h
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/DeclObjC.cpp
clang/lib/Analysis/BodyFarm.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CGObjCGNU.cpp
clang/lib/CodeGen/CGObjCMac.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
clang/lib/Frontend/Rewrite/RewriteObjC.cpp
clang/lib/Index/IndexDecl.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/lib/Sema/SemaExprObjC.cpp
clang/lib/Sema/SemaObjCProperty.cpp
clang/lib/Sema/SemaPseudoObject.cpp
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
clang/test/AST/ast-dump-decl-json.m
clang/test/Analysis/Inputs/expected-plists/nullability-notes.m.plist
clang/test/CodeGenObjC/debug-info-synthesis.m
clang/test/CodeGenObjC/debug-property-synth.m
clang/test/CodeGenObjC/debuginfo-properties.m
clang/test/CodeGenObjC/instance-method-metadata.m
clang/test/SemaObjC/iboutlet.m
clang/tools/libclang/CIndex.cpp

Removed: 




diff  --git a/clang/include/clang/AST/DeclBase.h 
b/clang/include/clang/AST/DeclBase.h
index 01c2f1809771..adea10b33188 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -1590,6 +1590,9 @@ class DeclContext {
 /// True if this method is the getter or setter for an explicit property.
 uint64_t IsPropertyAccessor : 1;
 
+/// True if this method is a synthesized property accessor stub.
+uint64_t IsSynthesizedAccessorStub : 1;
+
 /// Method has a definition.
 uint64_t IsDefined : 1;
 

diff  --git a/clang/include/clang/AST/DeclObjC.h 
b/clang/include/clang/AST/DeclObjC.h
index 8d85ac36d861..e5d3ebfadc06 100644
--- a/clang/include/clang/AST/DeclObjC.h
+++ b/clang/include/clang/AST/DeclObjC.h
@@ -172,6 +172,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext 
{
  Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo,
  DeclContext *contextDecl, bool isInstance = true,
  bool isVariadic = false, bool isPropertyAccessor = false,
+ bool isSynthesizedAccessorStub = false, 
  bool isImplicitlyDeclared = false, bool isDefined = false,
  ImplementationControl impControl = None,
  bool HasRelatedResultType = false);
@@ -232,6 +233,7 @@ class ObjCMethodDecl : public NamedDecl, public DeclContext 
{
  Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo,
  DeclContext *contextDecl, bool isInstance = true,
  bool isVariadic = false, bool isPropertyAccessor = false,
+ bool isSynthesizedAccessorStub = false,
  bool isImplicitlyDeclared = false, bool isDefined = false,
  ImplementationControl impControl = None,
  bool HasRelatedResultType = false);
@@ -436,6 +438,14 @@ class ObjCMethodDecl : public NamedDecl, public 
DeclContext {
 ObjCMethodDeclBits.IsPropertyAccessor = isAccessor;
   }
 
+  bool isSynthesizedAccessorStub() const {
+return ObjCMethodDeclBits.IsSynthesizedAccessorStub;
+  }
+
+  void setSynthesizedAccessorStub(bool isSynthesizedAccessorStub) {
+ObjCMethodDeclBits.IsSynthesizedAcc

[PATCH] D68108: Redeclare Objective-C property accessors inside the ObjCImplDecl in which they are synthesized.

2019-11-08 Thread Adrian Prantl via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2073dd2da702: Redeclare Objective-C property accessors 
inside the ObjCImplDecl in which they… (authored by aprantl).

Changed prior to commit:
  https://reviews.llvm.org/D68108?vs=227801&id=228467#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68108/new/

https://reviews.llvm.org/D68108

Files:
  clang/include/clang/AST/DeclBase.h
  clang/include/clang/AST/DeclObjC.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/DeclObjC.cpp
  clang/lib/Analysis/BodyFarm.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/CodeGen/CGObjCMac.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Frontend/Rewrite/RewriteObjC.cpp
  clang/lib/Index/IndexDecl.cpp
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/lib/Sema/SemaExprObjC.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaPseudoObject.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp
  clang/lib/StaticAnalyzer/Core/CallEvent.cpp
  clang/test/AST/ast-dump-decl-json.m
  clang/test/Analysis/Inputs/expected-plists/nullability-notes.m.plist
  clang/test/CodeGenObjC/debug-info-synthesis.m
  clang/test/CodeGenObjC/debug-property-synth.m
  clang/test/CodeGenObjC/debuginfo-properties.m
  clang/test/CodeGenObjC/instance-method-metadata.m
  clang/test/SemaObjC/iboutlet.m
  clang/tools/libclang/CIndex.cpp

Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -629,6 +629,11 @@
 Decl *D = *I;
 if (D->getLexicalDeclContext() != DC)
   continue;
+// Filter out synthesized property accessor redeclarations.
+if (isa(DC))
+  if (auto *OMD = dyn_cast(D))
+if (OMD->isSynthesizedAccessorStub())
+  continue;
 const Optional V = handleDeclForVisitation(D);
 if (!V.hasValue())
   continue;
Index: clang/test/SemaObjC/iboutlet.m
===
--- clang/test/SemaObjC/iboutlet.m
+++ clang/test/SemaObjC/iboutlet.m
@@ -11,7 +11,7 @@
 
 IBInspectable @property (readonly) IBOutlet NSView *myView1; // expected-warning {{readonly IBOutlet property 'myView1' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}}
 
-@property (getter = MyGetter, READONLY) IBOutlet NSView *myView2; // expected-warning {{readonly IBOutlet property 'myView2' when auto-synthesized may not work correctly with 'nib' loader}}
+@property (getter = MyGetter2, READONLY) IBOutlet NSView *myView2; // expected-warning {{readonly IBOutlet property 'myView2' when auto-synthesized may not work correctly with 'nib' loader}}
 
 @end
 
Index: clang/test/CodeGenObjC/instance-method-metadata.m
===
--- clang/test/CodeGenObjC/instance-method-metadata.m
+++ clang/test/CodeGenObjC/instance-method-metadata.m
@@ -1,6 +1,5 @@
 // REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -o %t %s 
-// RUN: FileCheck < %t %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S %s -o - | FileCheck %s
 
 // rdar://9072317
 
Index: clang/test/CodeGenObjC/debuginfo-properties.m
===
--- clang/test/CodeGenObjC/debuginfo-properties.m
+++ clang/test/CodeGenObjC/debuginfo-properties.m
@@ -11,19 +11,6 @@
 
 @protocol HasASelection 
 @property (nonatomic, retain) Selection* selection;
-// CHECK: !DISubprogram(name: "-[MyClass selection]"
-// CHECK-SAME:  line: [[@LINE-2]]
-// CHECK-SAME:  DISPFlagLocalToUnit | DISPFlagDefinition
-// CHECK: !DISubprogram(name: "-[MyClass setSelection:]"
-// CHECK-SAME:  line: [[@LINE-5]]
-// CHECK-SAME:  DISPFlagLocalToUnit | DISPFlagDefinition
-// CHECK: !DISubprogram(name: "-[OtherClass selection]"
-// CHECK-SAME:  line: [[@LINE-8]]
-// CHECK-SAME:  DISPFlagLocalToUnit | DISPFlagDefinition
-// CHECK: !DISubprogram(name: "-[OtherClass setSelection:]"
-// CHECK-SAME:  line: [[@LINE-11]]
-// CHECK-SAME:  DISPFlagLocalToUnit | DISPFlagDefinition
-
 @end
 
 @interface MyClass : NSObject  {
@@ -33,6 +20,12 @@
 
 @implementation MyClass
 @synthesize selection = _selection;
+// CHECK: !DISubprogram(name: "-[MyClass selection]"
+// CHECK-SAME:  line: [[@LINE-2]]
+// CHECK-SAME:  DISPFlagLocalToUnit | DISPFlagDefinition
+// CHECK: !DISubprogram(name: "-[MyClass setSelection:]"
+// CHECK-SAME:  line: [[@LINE-5]]
+// CHECK-SAME:  DISPFlagLocalToUnit | DISPFlagDefinition
 @end
 
 @interface OtherClass : NSObject  {
@@ -41,4 +3

[PATCH] D69322: [hip][cuda] Enable extended lambda support on Windows.

2019-11-08 Thread Michael Liao via Phabricator via cfe-commits
hliao added a comment.

PING for review


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69322/new/

https://reviews.llvm.org/D69322



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 9e48a94 - Fix two typos in one test name, three days before its 10th birthday! (NFC)

2019-11-08 Thread Adrian Prantl via cfe-commits

Author: Adrian Prantl
Date: 2019-11-08T09:03:46-08:00
New Revision: 9e48a946b7b5cb90690bbeb196b185eda2fd8982

URL: 
https://github.com/llvm/llvm-project/commit/9e48a946b7b5cb90690bbeb196b185eda2fd8982
DIFF: 
https://github.com/llvm/llvm-project/commit/9e48a946b7b5cb90690bbeb196b185eda2fd8982.diff

LOG: Fix two typos in one test name, three days before its 10th birthday! (NFC)

Added: 
clang/test/SemaObjC/atomic-property-synthesis-rules.m

Modified: 


Removed: 
clang/test/SemaObjC/atomoic-property-synnthesis-rules.m



diff  --git a/clang/test/SemaObjC/atomoic-property-synnthesis-rules.m 
b/clang/test/SemaObjC/atomic-property-synthesis-rules.m
similarity index 100%
rename from clang/test/SemaObjC/atomoic-property-synnthesis-rules.m
rename to clang/test/SemaObjC/atomic-property-synthesis-rules.m



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69995: [clang][IFS] Adding support for processing more decl types in clang interface stubs.

2019-11-08 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd accepted this revision.
compnerd added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp:202
+  // or templated type.
+  if (cast(ND)->getType()->isDependentType() ||
+  cast(ND)->isTemplated() || !ND->getIdentifier())

Not sure if I prefer this or:

```
if (!ND->getIdentifier())
  return true;
const auto *VD = cast(ND);
if (VD->isTemplated() || VD->getType()->isDependent())
  return true;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69995/new/

https://reviews.llvm.org/D69995



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 51adeae - remove redundant LLVM version from version string when setting CLANG_VENDOR

2019-11-08 Thread Nick Desaulniers via cfe-commits

Author: Nick Desaulniers
Date: 2019-11-08T09:24:17-08:00
New Revision: 51adeae1c90c966f5ae7eb1aa8a380fcc7cd4806

URL: 
https://github.com/llvm/llvm-project/commit/51adeae1c90c966f5ae7eb1aa8a380fcc7cd4806
DIFF: 
https://github.com/llvm/llvm-project/commit/51adeae1c90c966f5ae7eb1aa8a380fcc7cd4806.diff

LOG: remove redundant LLVM version from version string when setting CLANG_VENDOR

Summary:
When downstream LLVM distributions (like AOSP) set the CLANG_VENDOR
cmake variable, the version string printed by the clang driver looks
like:

$ clang --version
[CLANG_VENDOR] clang version X.X.X ([CLANG_REPOSITORY_STRING] sha) (based on 
LLVM X.X.X)

Rather than the more standard:
$ clang --version
clang version X.X.X ([CLANG_REPOSITORY_STRING] sha)

Based on feedback the the version string is a little long, the trailing
"(based on LLVM X.X.X)" is redundant and makes less sense after moving
LLVM to the monorepo. And it is only added should vendors set the cmake
variable CLANG_VENDOR. Let's remove it.

Reviewers: jyknight, eli.friedman, rsmith, rjmccall, efriedma

Reviewed By: efriedma

Subscribers: arphaman, efriedma, cfe-commits, srhines

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69925

Added: 


Modified: 
clang/lib/Basic/Version.cpp

Removed: 




diff  --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp
index d6564582e772..c69d13b2f689 100644
--- a/clang/lib/Basic/Version.cpp
+++ b/clang/lib/Basic/Version.cpp
@@ -127,11 +127,6 @@ std::string getClangToolFullVersion(StringRef ToolName) {
   OS << ToolName << " version " CLANG_VERSION_STRING " "
  << getClangFullRepositoryVersion();
 
-  // If vendor supplied, include the base LLVM version as well.
-#ifdef CLANG_VENDOR
-  OS << " (based on " << BACKEND_PACKAGE_STRING << ")";
-#endif
-
   return OS.str();
 }
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition

2019-11-08 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song updated this revision to Diff 228474.
yonghong-song retitled this revision from "[RFC][BPF] Add preserve_access_index 
attribute to record definition" to "[BPF] Add preserve_access_index attribute 
for record definition".
yonghong-song edited the summary of this revision.
yonghong-song added a comment.

handling inner records and array subscript accesses. removing RFC tag.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69759/new/

https://reviews.llvm.org/D69759

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/bpf-attr-preserve-access-index-1.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-2.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-3.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-4.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-5.c
  clang/test/CodeGen/bpf-attr-preserve-access-index-6.c
  clang/test/Sema/bpf-attr-preserve-access-index.c

Index: clang/test/Sema/bpf-attr-preserve-access-index.c
===
--- /dev/null
+++ clang/test/Sema/bpf-attr-preserve-access-index.c
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -x c -triple bpf-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s
+
+#define __reloc__ __attribute__((preserve_access_index))
+
+struct t1 {
+  int a;
+  int b[4];
+  int c:1;
+} __reloc__;
+
+union t2 {
+  int a;
+  int b[4];
+  int c:1;
+} __reloc__;
+
+struct u3 {
+  union {
+int a;
+char b[5];
+  };
+  struct {
+int c:1;
+  } __reloc__;
+  int d;
+} __reloc__;
+
+int a __reloc__; // expected-error {{preserve_addess_index attribute only applies to struct or union type}}
+struct s *p __reloc__; // expected-error {{preserve_addess_index attribute only applies to struct or union type}}
+
+void invalid1(const int __reloc__ *arg) {} // expected-error {{preserve_addess_index attribute only applies to struct or union type}}
+void invalid2() { const int __reloc__ *arg; } // expected-error {{preserve_addess_index attribute only applies to struct or union type}}
+int valid3(struct u3 *arg) { return arg->a + arg->b[3] + arg->c + arg->d; }
+int valid4(void *arg) {
+  struct local_t { int a; int b; } __reloc__;
+  return ((struct local_t *)arg)->b;
+}
Index: clang/test/CodeGen/bpf-attr-preserve-access-index-6.c
===
--- /dev/null
+++ clang/test/CodeGen/bpf-attr-preserve-access-index-6.c
@@ -0,0 +1,32 @@
+// REQUIRES: bpf-registered-target
+// RUN: %clang -target bpf -emit-llvm -S -g %s -o - | FileCheck %s
+
+#define __reloc__ __attribute__((preserve_access_index))
+
+// chain of records, both inner and outer record have attributes.
+struct s1 {
+  int c;
+} __reloc__;
+typedef struct s1 __s1;
+
+struct s2 {
+  union {
+__s1 b[3];
+  } __reloc__;
+} __reloc__;
+typedef struct s2 __s2;
+
+struct s3 {
+  __s2 a;
+} __reloc__;
+typedef struct s3 __s3;
+
+int test(__s3 *arg) {
+  return arg->a.b[2].c;
+}
+
+// CHECK: call %struct.s2* @llvm.preserve.struct.access.index.p0s_struct.s2s.p0s_struct.s3s(%struct.s3* %{{[0-9a-z]+}}, i32 0, i32 0)
+// CHECK: call %union.anon* @llvm.preserve.struct.access.index.p0s_union.anons.p0s_struct.s2s(%struct.s2* %{{[0-9a-z]+}}, i32 0, i32 0)
+// CHECK: call %union.anon* @llvm.preserve.union.access.index.p0s_union.anons.p0s_union.anons(%union.anon* %{{[0-9a-z]+}}, i32 0)
+// CHECK: call %struct.s1* @llvm.preserve.array.access.index.p0s_struct.s1s.p0a3s_struct.s1s([3 x %struct.s1]* %{{[0-9a-z]+}}, i32 1, i32 2)
+// CHECK: call i32* @llvm.preserve.struct.access.index.p0i32.p0s_struct.s1s(%struct.s1* %{{[0-9a-z]+}}, i32 0, i32 0)
Index: clang/test/CodeGen/bpf-attr-preserve-access-index-5.c
===
--- /dev/null
+++ clang/test/CodeGen/bpf-attr-preserve-access-index-5.c
@@ -0,0 +1,32 @@
+// REQUIRES: bpf-registered-target
+// RUN: %clang -target bpf -emit-llvm -S -g %s -o - | FileCheck %s
+
+#define __reloc__ __attribute__((preserve_access_index))
+
+// chain of records, attribute may be in inner record.
+struct s1 {
+  int c;
+} __reloc__;
+typedef struct s1 __s1;
+
+struct s2 {
+  union {
+__s1 b[3];
+  } __reloc__;
+};
+typedef struct s2 __s2;
+
+struct s3 {
+  __s2 a;
+} __reloc__;
+typedef struct s3 __s3;
+
+int test(__s3 *arg) {
+  return arg->a.b[2].c;
+}
+
+// CHECK: call %struct.s2* @llvm.preserve.struct.access.index.p0s_struct.s2s.p0s_struct.s3s(%struct.s3* %{{[0-9a-z]+}}, i32 0, i32 0)
+// CHECK-NOT: call %union.anon* @llvm.preserve.struct.access.index.p0s_union.anons.p0s_struct.s2s
+// CHECK: call %union.anon* @llvm.preserve.union.access.index.p0s_union.anons.p0s_union.anons(%union.anon* %{{[0-9a-z]+}}, i32 0)
+// CHECK: call %struct.s1* @llvm.preserve.array.access.index.p0s_struct.s1s.p0a3s_struct.s1s([3 x %struct.s1]

[PATCH] D69925: remove redundant LLVM version from version string when setting CLANG_VENDOR

2019-11-08 Thread Nick Desaulniers via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG51adeae1c90c: remove redundant LLVM version from version 
string when setting CLANG_VENDOR (authored by nickdesaulniers).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69925/new/

https://reviews.llvm.org/D69925

Files:
  clang/lib/Basic/Version.cpp


Index: clang/lib/Basic/Version.cpp
===
--- clang/lib/Basic/Version.cpp
+++ clang/lib/Basic/Version.cpp
@@ -127,11 +127,6 @@
   OS << ToolName << " version " CLANG_VERSION_STRING " "
  << getClangFullRepositoryVersion();
 
-  // If vendor supplied, include the base LLVM version as well.
-#ifdef CLANG_VENDOR
-  OS << " (based on " << BACKEND_PACKAGE_STRING << ")";
-#endif
-
   return OS.str();
 }
 


Index: clang/lib/Basic/Version.cpp
===
--- clang/lib/Basic/Version.cpp
+++ clang/lib/Basic/Version.cpp
@@ -127,11 +127,6 @@
   OS << ToolName << " version " CLANG_VERSION_STRING " "
  << getClangFullRepositoryVersion();
 
-  // If vendor supplied, include the base LLVM version as well.
-#ifdef CLANG_VENDOR
-  OS << " (based on " << BACKEND_PACKAGE_STRING << ")";
-#endif
-
   return OS.str();
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition

2019-11-08 Thread Alexei Starovoitov via Phabricator via cfe-commits
ast added a comment.

Looks great. This is a big improvement in usability.
Is there a use case to apply that attribute to inner types automatically ?

  struct s1 {
int foo;
  };
  struct s2 {
 struct s1 *ptr;
  } __reloc__ *s2;

s2->ptr->foo -- will both deref be relocatable or only first?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69759/new/

https://reviews.llvm.org/D69759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69762: [Diagnostics] Try to improve warning message for -Wreturn-type

2019-11-08 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment.

We cannot use it for block; it is a hard error. Corountine and function can be 
merged as suggested.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69762/new/

https://reviews.llvm.org/D69762



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69951: [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst

2019-11-08 Thread Mitchell via Phabricator via cfe-commits
mitchell-stellar added inline comments.



Comment at: clang/docs/ClangFormatStyleOptions.rst:1589
+  statement. Switch statement body is always indented one level more than
+  case labels. \code
  false: true:

This generated rst is not correct. See below.



Comment at: clang/include/clang/Format/Format.h:1313
+  /// statement. Switch statement body is always indented one level more than
+  /// case labels. \code
   ///false: true:

`\code` needs to be on its own line. Otherwise you get the incorrectly 
generated .rst I mentioned earlier.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69951/new/

https://reviews.llvm.org/D69951



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69952: [OPENMP50]Generalize handling of context matching/scoring.

2019-11-08 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev updated this revision to Diff 228481.
ABataev added a comment.

Score is part of context data.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69952/new/

https://reviews.llvm.org/D69952

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/OpenMPKinds.def
  clang/include/clang/Basic/OpenMPKinds.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Basic/OpenMPKinds.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/Parse/ParseOpenMP.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -388,22 +388,36 @@
   if (Expr *E = Attr.getVariantFuncRef())
 VariantFuncRef = Subst(E);
 
-  ExprResult Score;
-  if (Expr *E = Attr.getScore())
-Score = Subst(E);
-
   // Check function/variant ref.
   Optional> DeclVarData =
   S.checkOpenMPDeclareVariantFunction(
   S.ConvertDeclToDeclGroup(New), VariantFuncRef.get(), Attr.getRange());
   if (!DeclVarData)
 return;
-  // Instantiate the attribute.
-  Sema::OpenMPDeclareVariantCtsSelectorData Data(
-  Attr.getCtxSelectorSet(), Attr.getCtxSelector(),
-  llvm::makeMutableArrayRef(Attr.implVendors_begin(),
-Attr.implVendors_size()),
-  Score);
+  SmallVector Data;
+  for (unsigned I = 0, E = Attr.scores_size(); I < E; ++I) {
+ExprResult Score;
+if (Expr *E = *std::next(Attr.scores_begin(), I))
+  Score = Subst(E);
+// Instantiate the attribute.
+auto CtxSet = static_cast(
+*std::next(Attr.ctxSelectorSets_begin(), I));
+auto Ctx = static_cast(
+*std::next(Attr.ctxSelectors_begin(), I));
+switch (CtxSet) {
+case OMPCtxSet_implementation:
+  switch (Ctx) {
+  case OMPCtx_vendor:
+Data.emplace_back(CtxSet, Ctx, Score, Attr.implVendors());
+break;
+  case OMPCtxUnknown:
+llvm_unreachable("Unexpected context selector kind.");
+  }
+  break;
+case OMPCtxSetUnknown:
+  llvm_unreachable("Unexpected context selector set kind.");
+}
+  }
   S.ActOnOpenMPDeclareVariantDirective(DeclVarData.getValue().first,
DeclVarData.getValue().second,
Attr.getRange(), Data);
Index: clang/lib/Sema/SemaOpenMP.cpp
===
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -5192,28 +5192,59 @@
 
 void Sema::ActOnOpenMPDeclareVariantDirective(
 FunctionDecl *FD, Expr *VariantRef, SourceRange SR,
-const Sema::OpenMPDeclareVariantCtsSelectorData &Data) {
-  if (Data.CtxSet == OMPDeclareVariantAttr::CtxSetUnknown ||
-  Data.Ctx == OMPDeclareVariantAttr::CtxUnknown)
+ArrayRef Data) {
+  if (Data.empty())
 return;
-  Expr *Score = nullptr;
-  if (Data.CtxScore.isUsable()) {
-Score = Data.CtxScore.get();
-if (!Score->isTypeDependent() && !Score->isValueDependent() &&
-!Score->isInstantiationDependent() &&
-!Score->containsUnexpandedParameterPack()) {
-  llvm::APSInt Result;
-  ExprResult ICE = VerifyIntegerConstantExpression(Score, &Result);
-  if (ICE.isInvalid())
-return;
+  SmallVector CtxScores;
+  SmallVector CtxSets;
+  SmallVector Ctxs;
+  SmallVector ImplVendors;
+  bool IsError = false;
+  for (const OMPCtxSelectorData &D : Data) {
+OpenMPContextSelectorSetKind CtxSet = D.CtxSet;
+OpenMPContextSelectorKind Ctx = D.Ctx;
+if (CtxSet == OMPCtxSetUnknown || Ctx == OMPCtxUnknown)
+  return;
+Expr *Score = nullptr;
+if (D.Score.isUsable()) {
+  Score = D.Score.get();
+  if (!Score->isTypeDependent() && !Score->isValueDependent() &&
+  !Score->isInstantiationDependent() &&
+  !Score->containsUnexpandedParameterPack()) {
+Score =
+PerformOpenMPImplicitIntegerConversion(Score->getExprLoc(), Score)
+.get();
+if (Score)
+  Score = VerifyIntegerConstantExpression(Score).get();
+  }
+} else {
+  Score = ActOnIntegerConstant(SourceLocation(), 0).get();
 }
-  } else {
-Score = ActOnIntegerConstant(SourceLocation(), 0).get();
+switch (CtxSet) {
+case OMPCtxSet_implementation:
+  switch (Ctx) {
+  case OMPCtx_vendor:
+ImplVendors.append(D.Names.begin(), D.Names.end());
+break;
+  case OMPCtxUnknown:
+llvm_unreachable("Unexpected context selector kind.");
+  }
+  break;
+case OMPCtxSetUnknown:
+  llvm_unreachable("Unexpected context selector set kind.");
+}
+IsError = IsError || !Score;
+CtxSets.push_back(CtxSet);
+Ctxs.push_back(Ctx);
+CtxScores.push_back(Score);
+  }
+  

[PATCH] D69950: Reapply "Fix crash on switch conditions of non-integer types in templates"

2019-11-08 Thread Elizabeth Andrews via Phabricator via cfe-commits
eandrews added a subscriber: mibintc.
eandrews added a comment.

Thank you for taking a look Reid and Dmitri. There were no fails with check-all.

My commit rights have not been transferred from SVN to Github yet, so Melanie 
(@mibintc) has kindly agreed to commit this patch for me.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69950/new/

https://reviews.llvm.org/D69950



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition

2019-11-08 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

For the below:
 struct s1 {

  int foo;

};
 struct s2 {

  struct s1 *ptr;

} __reloc__ *s2;

s2->ptr->foo -- will both deref be relocatable or only first?
Only s2->ptr is relocated.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69759/new/

https://reviews.llvm.org/D69759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69785: [OpenMP] Introduce the OpenMP-IR-Builder

2019-11-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert marked 2 inline comments as done.
jdoerfert added inline comments.



Comment at: llvm/lib/IR/OpenMPIRBuilder.cpp:153-159
+// Search the entry block, not needed once all thread id calls go through
+// here and are cached in the OpenMPIRBuilder.
+for (Instruction &I : Fn->getEntryBlock())
+  if (CallInst *CI = dyn_cast(&I))
+if (CI->getCalledFunction() &&
+CI->getCalledFunction()->getName() == "__kmpc_global_thread_num")
+  return TID = CI;

ABataev wrote:
> Do you really need this if you have a deduplication pass?
Not once the pass is in. I'll remove this with the pass.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69785/new/

https://reviews.llvm.org/D69785



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition

2019-11-08 Thread Alexei Starovoitov via Phabricator via cfe-commits
ast added a comment.

Is the attribute sticky with forward delcarations?

  struct s __reloc;
  
  struct s {
int foo;
  } *s;

what is s->foo ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69759/new/

https://reviews.llvm.org/D69759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69760: [Clang][Driver] Don't pun -fuse-ld=lld as -fuse-ld=lld-link with msvc

2019-11-08 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 added a comment.

While I am fine making `-fuse-ld=lld` mean "use that lld driver most 
appropriate for the clang driver", in principle the clang driver and lld driver 
choices are orthogonal, and I'd want to expose that with something like 
`-fuse-ld=ld.lld` to compliment `-fuse-ld=lld-link`. How does that sound? 
Should we support `-fuse-ld=ld.bfd` and `-fuse-ld=ld64.lld` too?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69760/new/

https://reviews.llvm.org/D69760



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66121: Debug Info: Nest Objective-C property function decls inside their container.

2019-11-08 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl updated this revision to Diff 228484.
aprantl marked 3 inline comments as done.
aprantl added a reviewer: vsk.
aprantl added a comment.

Address comments from Vedant.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66121/new/

https://reviews.llvm.org/D66121

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGenObjC/debug-info-objc-property-dwarf5.m

Index: clang/test/CodeGenObjC/debug-info-objc-property-dwarf5.m
===
--- /dev/null
+++ clang/test/CodeGenObjC/debug-info-objc-property-dwarf5.m
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -dwarf-version=5 %s -o - | FileCheck %s
+
+@protocol NSObject
+@end
+
+@interface NSObject  {}
+@end
+
+struct Bar {};
+
+@protocol BarProto
+@property struct Bar *bar;
+@end
+
+@interface Foo 
+@end
+
+@implementation Foo {}
+@synthesize bar = _bar;
+- (void)f {}
+@end
+
+// CHECK: ![[FOO:[0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "Foo"
+
+// CHECK: ![[DECL:[0-9]+]] = !DISubprogram(name: "-[Foo setBar:]",
+// CHECK-SAME:  scope: ![[FOO]]
+
+// CHECK: distinct !DISubprogram(name: "-[Foo setBar:]",
+// CHECK-SAME:  declaration: ![[DECL:[0-9]+]]
Index: clang/lib/CodeGen/CGDebugInfo.h
===
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -613,6 +613,17 @@
   /// declaration for the given method definition.
   llvm::DISubprogram *getFunctionDeclaration(const Decl *D);
 
+  /// \return  debug info descriptor to the describe method declaration
+  ///  for the given method definition.
+  /// \param FnTypeFor Objective-C methods, their type.
+  /// \param LineNoThe declaration's line number.
+  /// \param Flags The DIFlags for the method declaration.
+  /// \param SPFlags   The subprogram-spcific flags for the method declaration.
+  llvm::DISubprogram *
+  getObjCMethodDeclaration(const Decl *D, llvm::DISubroutineType *FnType,
+   unsigned LineNo, llvm::DINode::DIFlags Flags,
+   llvm::DISubprogram::DISPFlags SPFlags);
+
   /// \return debug info descriptor to describe in-class static data
   /// member declaration for the given out-of-class definition.  If D
   /// is an out-of-class definition of a static data member of a
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2600,8 +2600,8 @@
   SourceLocation Loc = PD->getLocation();
   llvm::DIFile *PUnit = getOrCreateFile(Loc);
   unsigned PLine = getLineNumber(Loc);
-  ObjCMethodDecl *Getter = PD->getGetterMethodDecl();
-  ObjCMethodDecl *Setter = PD->getSetterMethodDecl();
+  ObjCMethodDecl *Getter = PImpD->getGetterMethodDecl();
+  ObjCMethodDecl *Setter = PImpD->getSetterMethodDecl();
   PropertyNode = DBuilder.createObjCProperty(
   PD->getName(), PUnit, PLine,
   hasDefaultGetterName(PD, Getter)
@@ -3490,6 +3490,38 @@
   return nullptr;
 }
 
+llvm::DISubprogram *CGDebugInfo::getObjCMethodDeclaration(
+const Decl *D, llvm::DISubroutineType *FnType, unsigned LineNo,
+llvm::DINode::DIFlags Flags, llvm::DISubprogram::DISPFlags SPFlags) {
+  if (!D || DebugKind <= codegenoptions::DebugLineTablesOnly)
+return nullptr;
+
+  if (CGM.getCodeGenOpts().DwarfVersion < 5)
+return nullptr;
+
+  // Starting with DWARF V5 method declarations are emitted as children of
+  // the interface type.
+  const auto *OMD = dyn_cast(D);
+  if (!OMD)
+return nullptr;
+  auto *ID = dyn_cast_or_null(D->getDeclContext());
+  if (!ID)
+ID = OMD->getClassInterface();
+  if (!ID)
+return nullptr;
+  QualType QTy(ID->getTypeForDecl(), 0);
+  auto It = TypeCache.find(QTy.getAsOpaquePtr());
+  if (It == TypeCache.end())
+return nullptr;
+  auto *InterfaceType = cast(It->second);
+  llvm::DISubprogram *FD = DBuilder.createFunction(
+  InterfaceType, getObjCMethodName(OMD), StringRef(),
+  InterfaceType->getFile(), LineNo, FnType, LineNo, Flags, SPFlags);
+  DBuilder.finalizeSubprogram(FD);
+  ObjCMethodCache[ID].push_back(FD);
+  return FD;
+}
+
 // getOrCreateFunctionType - Construct type. If it is a c++ method, include
 // implicit parameter "this".
 llvm::DISubroutineType *CGDebugInfo::getOrCreateFunctionType(const Decl *D,
@@ -3632,6 +3664,12 @@
 
   unsigned LineNo = getLineNumber(Loc);
   unsigned ScopeLine = getLineNumber(ScopeLoc);
+  llvm::DISubroutineType *DIFnType = getOrCreateFunctionType(D, FnType, Unit);
+  llvm::DISubprogram *Decl = nullptr;
+  if (D)
+Decl = isa(D)
+   ? getObjCMethodDeclaration(D, DIFnType, LineNo, Flags, SPFlags)
+   : getFunctionDeclaration(D);
 
   // FIXME: The function declaration we're construc

[PATCH] D69766: [Clang][MSVC] Use GetLinkerPath like the other toolchains for consistency

2019-11-08 Thread John Ericson via Phabricator via cfe-commits
Ericson2314 added a comment.

Reading https://llvm.org/docs/DeveloperPolicy.html it looks like I need to 
submit an patch email? Is that true, or can/will someone with perms see the 
approval and eventually merge it from phabricator?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69766/new/

https://reviews.llvm.org/D69766



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69922: [OpenMP] Use the OpenMP-IR-Builder

2019-11-08 Thread Johannes Doerfert via Phabricator via cfe-commits
jdoerfert marked an inline comment as done.
jdoerfert added inline comments.



Comment at: clang/test/OpenMP/barrier_codegen.cpp:22
+// CLANGCG-NOT: readonly
+// IRBUILDER:  ; Function Attrs: nofree nosync nounwind readonly
+// IRBUILDER-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*)

ABataev wrote:
> Not sure about correct use of `nosync` and `readonly` attributes. OpenMP 
> runtime uses lazy initialization of the runtime library and when any runtime 
> function is called, the inner parts of the OpenMP runtime are initialized 
> automatically. It may use some sync primitives and may modify memory, I 
> assume. Same about `nofree`.
There are two versions of these functions, host and device. I assume host 
functions are not inlined but device functions might be. This is basically all 
the modes we support right now.

If we do not inline the function (host) we don't necessarily care what they do 
but what effect the user can expect.
The user can not expect to synchronize through `__kmpc_global_thread_num` calls 
in a defined way, thus `nosync`.
Similarly, from the users perspective there is no way to determine if something 
was written or freed, no matter how many of these calls I issue and under which 
control conditions, all I see is the number as a result. Thus, `readonly` and 
`nofree`. I believe `readnone` is even fine here but it might not work for the 
device version (see below) so I removed it.

If we do inline the function (device) we need to make sure the attributes are 
compatible with the inlined code to not cause UB. The code of 
`__kmpc_global_thread_num` at least does not write anything and only reads 
stuff (as far as I can tell).

Please correct me if I overlooked something. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69922/new/

https://reviews.llvm.org/D69922



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D67460: clang-tidy: modernize-use-using work with multi-argument templates

2019-11-08 Thread Conrad Poelman via Phabricator via cfe-commits
poelmanc added a comment.

Thanks @aaron.ballman, I don't have commit access so will someone else commit 
this?

To address the minor nit, should I upload a new patch with 
post-increment/post-decrement changed to pre-increment/pre-decrement? (Does 
uploading changes undo the "Ready to Land" status?)


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67460/new/

https://reviews.llvm.org/D67460



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69950: Reapply "Fix crash on switch conditions of non-integer types in templates"

2019-11-08 Thread Melanie Blower via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG759948467ea3: Reapply "Fix crash on switch conditions 
of non-integer types in templates" (authored by mibintc).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69950/new/

https://reviews.llvm.org/D69950

Files:
  
clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
  clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/test/SemaCXX/constant-expression-cxx2a.cpp
  clang/test/SemaTemplate/dependent-names.cpp
  clang/test/SemaTemplate/enum-argument.cpp
  clang/test/SemaTemplate/member-access-expr.cpp
  clang/test/SemaTemplate/non-integral-switch-cond.cpp

Index: clang/test/SemaTemplate/non-integral-switch-cond.cpp
===
--- /dev/null
+++ clang/test/SemaTemplate/non-integral-switch-cond.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct NOT_AN_INTEGRAL_TYPE {};
+
+template 
+struct foo {
+  NOT_AN_INTEGRAL_TYPE Bad;
+  void run() {
+switch (Bad) { // expected-error {{statement requires expression of integer type ('NOT_AN_INTEGRAL_TYPE' invalid)}}
+case 0:
+  break;
+}
+  }
+};
Index: clang/test/SemaTemplate/member-access-expr.cpp
===
--- clang/test/SemaTemplate/member-access-expr.cpp
+++ clang/test/SemaTemplate/member-access-expr.cpp
@@ -156,7 +156,7 @@
 void get(B **ptr) {
   // It's okay if at some point we figure out how to diagnose this
   // at instantiation time.
-  *ptr = field;
+  *ptr = field; // expected-error {{assigning to 'test6::B *' from incompatible type 'test6::A *}}
 }
   };
 }
Index: clang/test/SemaTemplate/enum-argument.cpp
===
--- clang/test/SemaTemplate/enum-argument.cpp
+++ clang/test/SemaTemplate/enum-argument.cpp
@@ -1,5 +1,4 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
-// expected-no-diagnostics
 
 enum Enum { val = 1 };
 template  struct C {
@@ -31,7 +30,7 @@
 unsigned long long bitfield : e0;
 
 void f(int j) {
-  bitfield + j;
+  bitfield + j; // expected-warning {{expression result unused}}
 }
   };
 }
Index: clang/test/SemaTemplate/dependent-names.cpp
===
--- clang/test/SemaTemplate/dependent-names.cpp
+++ clang/test/SemaTemplate/dependent-names.cpp
@@ -273,9 +273,6 @@
   }
   int e[10];
 };
-void g() {
-  S().f(); // expected-note {{here}}
-}
   }
 
   namespace A2 {
Index: clang/test/SemaCXX/constant-expression-cxx2a.cpp
===
--- clang/test/SemaCXX/constant-expression-cxx2a.cpp
+++ clang/test/SemaCXX/constant-expression-cxx2a.cpp
@@ -18,6 +18,7 @@
 [[nodiscard]] void *operator new(std::size_t, std::align_val_t, const std::nothrow_t&) noexcept;
 [[nodiscard]] void *operator new[](std::size_t, const std::nothrow_t&) noexcept;
 [[nodiscard]] void *operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) noexcept;
+[[nodiscard]] void *operator new[](std::size_t, std::align_val_t);
 void operator delete(void*, const std::nothrow_t&) noexcept;
 void operator delete(void*, std::align_val_t, const std::nothrow_t&) noexcept;
 void operator delete[](void*, const std::nothrow_t&) noexcept;
@@ -1050,7 +1051,7 @@
 // Ensure that we don't try to evaluate these for overflow and crash. These
 // are all value-dependent expressions.
 p = new char[n];
-p = new (n) char[n];
+p = new ((std::align_val_t)n) char[n];
 p = new char(n);
   }
 }
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -14682,6 +14682,8 @@
   bool AnyIsPacked = false;
   do {
 QualType BaseType = ME->getBase()->getType();
+if (BaseType->isDependentType())
+  return;
 if (ME->isArrow())
   BaseType = BaseType->getPointeeType();
 RecordDecl *RD = BaseType->castAs()->getDecl();
Index: clang/lib/AST/Expr.cpp
===
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -1675,6 +1675,15 @@
   MemberExpr *E = new (Mem) MemberExpr(Base, IsArrow, OperatorLoc, MemberDecl,
NameInfo, T, VK, OK, NOUR);
 
+  if (FieldDecl *Field = dyn_cast(MemberDecl)) {
+DeclContext *DC = MemberDecl->getDeclContext();
+// dyn_cast_or_null is used to handle objC variables which do not
+// have a declaration context.
+CXXRecordDecl *RD = dyn_cast_or_null(DC);
+if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC))
+  E->setTypeD

[clang] 7599484 - Reapply "Fix crash on switch conditions of non-integer types in templates"

2019-11-08 Thread Melanie Blower via cfe-commits

Author: Melanie Blower
Date: 2019-11-08T10:17:06-08:00
New Revision: 759948467ea3181615d44d80f74ffeb260180fd0

URL: 
https://github.com/llvm/llvm-project/commit/759948467ea3181615d44d80f74ffeb260180fd0
DIFF: 
https://github.com/llvm/llvm-project/commit/759948467ea3181615d44d80f74ffeb260180fd0.diff

LOG: Reapply "Fix crash on switch conditions of non-integer types in templates"

This patch reapplies commit 76945821b9cad3. The first version broke
buildbots due to clang-tidy test fails. The fails are because some
errors in templates are now diagnosed earlier (does not wait till
instantiation). I have modified the tests to add checks for these
diagnostics/prevent these diagnostics. There are no additional code
changes.

Summary of code changes:

Clang currently crashes for switch statements inside a template when the
condition is a non-integer field member because contextual implicit
conversion is skipped when parsing the condition. This conversion is
however later checked in an assert when the case statement is handled.
The conversion is skipped when parsing the condition because
the field member is set as type-dependent based on its containing class.
This patch sets the type dependency based on the field's type instead.

This patch fixes Bug 40982.

Reviewers: rnk, gribozavr2

Patch by: Elizabeth Andrews (eandrews)

Differential revision: https://reviews.llvm.org/D69950

Added: 
clang/test/SemaTemplate/non-integral-switch-cond.cpp

Modified: 

clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
clang/lib/AST/Expr.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/SemaCXX/constant-expression-cxx2a.cpp
clang/test/SemaTemplate/dependent-names.cpp
clang/test/SemaTemplate/enum-argument.cpp
clang/test/SemaTemplate/member-access-expr.cpp

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
index 18fe5ef4e5c2..79d41ef77c80 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone-string-integer-assignment.cpp
@@ -103,6 +103,8 @@ struct S {
   static constexpr T t = 0x8000;
   std::string s;
   void f(char c) { s += c | static_cast(t); }
+  // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: an integer is interpreted as a 
chara
+  // CHECK-FIXES: {{^}}  void f(char c) { s += std::to_string(c | 
static_cast(t)); } 
 };
 
 template S;

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
index 119eff67318e..8e546b44ab74 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc-unused-parameters.cpp
@@ -233,7 +233,7 @@ struct a {
 template 
 class d {
   a e;
-  void f() { e.b(); }
+  void f() { e.b(0); }
 };
 }  // namespace
 }  // namespace PR38055

diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 3438c3aadc6b..00ba329642c8 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1675,6 +1675,15 @@ MemberExpr *MemberExpr::Create(
   MemberExpr *E = new (Mem) MemberExpr(Base, IsArrow, OperatorLoc, MemberDecl,
NameInfo, T, VK, OK, NOUR);
 
+  if (FieldDecl *Field = dyn_cast(MemberDecl)) {
+DeclContext *DC = MemberDecl->getDeclContext();
+// dyn_cast_or_null is used to handle objC variables which do not
+// have a declaration context.
+CXXRecordDecl *RD = dyn_cast_or_null(DC);
+if (RD && RD->isDependentContext() && RD->isCurrentInstantiation(DC))
+  E->setTypeDependent(T->isDependentType());
+  }
+
   if (HasQualOrFound) {
 // FIXME: Wrong. We should be looking at the member declaration we found.
 if (QualifierLoc && QualifierLoc.getNestedNameSpecifier()->isDependent()) {

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8322a9bf1477..45a3a7f5b00d 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -14682,6 +14682,8 @@ void Sema::RefersToMemberWithReducedAlignment(
   bool AnyIsPacked = false;
   do {
 QualType BaseType = ME->getBase()->getType();
+if (BaseType->isDependentType())
+  return;
 if (ME->isArrow())
   BaseType = BaseType->getPointeeType();
 RecordDecl *RD = BaseType->castAs()->getDecl();

diff  --git a/clang/test/SemaCXX/constant-expression-cxx2a.cpp 
b/clang/test/SemaCXX/constant-expression-cxx2a.cpp
index 8db705dcdc67..c2e443b9bec1 100644
--- a/clang/test/SemaCXX/constant-expression-cxx2a.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx2a.cpp
@@ -18,6 +18,7 @@ namespace std {
 [[nodi

[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition

2019-11-08 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

> Is the attribute sticky with forward delcarations?

forward declaration is not a record type, so an error will be emited if you 
have attribute on a forward declaration.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69759/new/

https://reviews.llvm.org/D69759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69951: [clang-format] NFC allow Format.h to be clang-formatted but still maintain the same doc layout in ClangFormatStyleOptions.rst

2019-11-08 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 228491.
MyDeveloperDay marked 4 inline comments as done.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69951/new/

https://reviews.llvm.org/D69951

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h


Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -1161,6 +1161,7 @@
   /// \endcode
   bool CompactNamespaces;
 
+  // clang-format off
   /// If the constructor initializers don't fit on a line, put each
   /// initializer on its own line.
   /// \code
@@ -1178,6 +1179,7 @@
   ///   }
   /// \endcode
   bool ConstructorInitializerAllOnOneLineOrOnePerLine;
+  // clang-format on
 
   /// The number of characters to use for indentation of constructor
   /// initializer lists as well as inheritance lists.
@@ -1306,8 +1308,9 @@
 
   /// Indent case labels one level from the switch statement.
   ///
-  /// When ``false``, use the same indentation level as for the switch 
statement.
-  /// Switch statement body is always indented one level more than case labels.
+  /// When ``false``, use the same indentation level as for the switch
+  /// statement. Switch statement body is always indented one level more than
+  /// case labels.
   /// \code
   ///false: true:
   ///switch (fool) {vs. switch (fool) {
@@ -1453,6 +1456,7 @@
   /// The JavaScriptQuoteStyle to use for JavaScript strings.
   JavaScriptQuoteStyle JavaScriptQuotes;
 
+  // clang-format off
   /// Whether to wrap JavaScript import/export statements.
   /// \code{.js}
   ///true:
@@ -1466,6 +1470,7 @@
   ///import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying, 
VeryLongImportsAreAnnoying,} from "some/module.js"
   /// \endcode
   bool JavaScriptWrapImports;
+  // clang-format on
 
   /// If true, the empty line at the start of blocks is kept.
   /// \code
@@ -1747,6 +1752,7 @@
   /// \endcode
   std::vector RawStringFormats;
 
+  // clang-format off
   /// If ``true``, clang-format will attempt to re-flow comments.
   /// \code
   ///false:
@@ -1760,6 +1766,7 @@
   /// * information */
   /// \endcode
   bool ReflowComments;
+  // clang-format on
 
   /// If ``true``, clang-format will sort ``#includes``.
   /// \code
@@ -2294,8 +2301,7 @@
 /// a non-recoverable syntax error.
 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code,
ArrayRef Ranges,
-   StringRef FileName,
-   bool *IncompleteFormat);
+   StringRef FileName, bool *IncompleteFormat);
 
 /// Clean up any erroneous/redundant code in the given \p Ranges in \p
 /// Code.
@@ -2406,6 +2412,6 @@
 namespace std {
 template <>
 struct is_error_code_enum : std::true_type {};
-}
+} // namespace std
 
 #endif // LLVM_CLANG_FORMAT_FORMAT_H
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -1584,8 +1584,9 @@
 **IndentCaseLabels** (``bool``)
   Indent case labels one level from the switch statement.
 
-  When ``false``, use the same indentation level as for the switch statement.
-  Switch statement body is always indented one level more than case labels.
+  When ``false``, use the same indentation level as for the switch
+  statement. Switch statement body is always indented one level more than
+  case labels.
 
   .. code-block:: c++
 


Index: clang/include/clang/Format/Format.h
===
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -1161,6 +1161,7 @@
   /// \endcode
   bool CompactNamespaces;
 
+  // clang-format off
   /// If the constructor initializers don't fit on a line, put each
   /// initializer on its own line.
   /// \code
@@ -1178,6 +1179,7 @@
   ///   }
   /// \endcode
   bool ConstructorInitializerAllOnOneLineOrOnePerLine;
+  // clang-format on
 
   /// The number of characters to use for indentation of constructor
   /// initializer lists as well as inheritance lists.
@@ -1306,8 +1308,9 @@
 
   /// Indent case labels one level from the switch statement.
   ///
-  /// When ``false``, use the same indentation level as for the switch statement.
-  /// Switch statement body is always indented one level more than case labels.
+  /// When ``false``, use the same indentation level as for the switch
+  /// statement. Switch statement body is always indented one level more than
+  /// case labels.
   /// \code
   ///false: true:
   ///switch (fool) {vs. switch (fool) {
@@ -1453,6 +1456,7 @@
   /// The JavaScriptQuoteStyle to use for JavaScript strings

[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition

2019-11-08 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

For question

>   Is there a use case to apply that attribute to inner types automatically ?

It is possible, but I feel make attribute per record is better. For example,

  struct s1 {
   int foo;
  }; 
  struct s2 {
   struct s1 *ptr;
  } __reloc__ *s2;

If we implicitly mark struct `s1` as __reloc__, later user may have
another code like

  struct s1 *p;
  p->foo

he may be surprised by relocation.
If this is user intention to have relocation for struct `s1`,
I think explicit attribute is better.

Another question would be during IR generation can we magically generate 
relocation for `ptr->foo` in `s2->ptr->foo`? Without marking the record, this 
will require pass context sensitive information along code generation, which 
could be error prone as when to clear such context sensitive information. I 
would prefer explicit marking.  If user uses vmlinux.h, all struct/unions in 
vmlinux.h could have this attribute. If user defines their own structures for 
later relocation, I expect this should not be a huge amount and some manual 
work by users should be okay.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69759/new/

https://reviews.llvm.org/D69759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69922: [OpenMP] Use the OpenMP-IR-Builder

2019-11-08 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/test/OpenMP/barrier_codegen.cpp:22
+// CLANGCG-NOT: readonly
+// IRBUILDER:  ; Function Attrs: nofree nosync nounwind readonly
+// IRBUILDER-NEXT: declare i32 @__kmpc_global_thread_num(%struct.ident_t*)

jdoerfert wrote:
> ABataev wrote:
> > Not sure about correct use of `nosync` and `readonly` attributes. OpenMP 
> > runtime uses lazy initialization of the runtime library and when any 
> > runtime function is called, the inner parts of the OpenMP runtime are 
> > initialized automatically. It may use some sync primitives and may modify 
> > memory, I assume. Same about `nofree`.
> There are two versions of these functions, host and device. I assume host 
> functions are not inlined but device functions might be. This is basically 
> all the modes we support right now.
> 
> If we do not inline the function (host) we don't necessarily care what they 
> do but what effect the user can expect.
> The user can not expect to synchronize through `__kmpc_global_thread_num` 
> calls in a defined way, thus `nosync`.
> Similarly, from the users perspective there is no way to determine if 
> something was written or freed, no matter how many of these calls I issue and 
> under which control conditions, all I see is the number as a result. Thus, 
> `readonly` and `nofree`. I believe `readnone` is even fine here but it might 
> not work for the device version (see below) so I removed it.
> 
> If we do inline the function (device) we need to make sure the attributes are 
> compatible with the inlined code to not cause UB. The code of 
> `__kmpc_global_thread_num` at least does not write anything and only reads 
> stuff (as far as I can tell).
> 
> Please correct me if I overlooked something. 
But someone may try to inline the host-based runtime or try to use LTO with it.
The question is not about the user expectations but about the optimizations 
which can be triggered with these attributes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69922/new/

https://reviews.llvm.org/D69922



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69759: [BPF] Add preserve_access_index attribute for record definition

2019-11-08 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

But it does not work for inner structs any more.
 -bash-4.4$ cat t.c
 #define __reloc__ __attribute__((preserve_access_index))
 struct __reloc__ p;
 struct p {

  int a;
  struct {
   int b;
  };

};

int test(struct p *arg) {

  return arg->b;

}
 -bash-4.4$

In only generates reloc for struct p's immediate members, but not inner 
structures.
The forward declaration gives empty record with attribute set, but this set 
does not
extend to inner record.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69759/new/

https://reviews.llvm.org/D69759



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69971: clang-format: [JS] support null operators.

2019-11-08 Thread Martin Probst via Phabricator via cfe-commits
mprobst updated this revision to Diff 228495.
mprobst added a comment.

Add tests for .?(foo) and .?[foo].


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69971/new/

https://reviews.llvm.org/D69971

Files:
  clang/lib/Format/FormatToken.h
  clang/lib/Format/FormatTokenLexer.cpp
  clang/unittests/Format/FormatTestJS.cpp


Index: clang/unittests/Format/FormatTestJS.cpp
===
--- clang/unittests/Format/FormatTestJS.cpp
+++ clang/unittests/Format/FormatTestJS.cpp
@@ -,6 +,16 @@
   verifyFormat("return !!x;\n");
 }
 
+TEST_F(FormatTestJS, NullPropagatingOperator) {
+  verifyFormat("let x = foo?.bar?.baz();\n");
+  verifyFormat("let x = foo?.(foo);\n");
+  verifyFormat("let x = foo?.['arr'];\n");
+}
+
+TEST_F(FormatTestJS, NullishCoalescingOperator) {
+  verifyFormat("const val = something ?? 'some other default';\n");
+}
+
 TEST_F(FormatTestJS, Conditional) {
   verifyFormat("y = x ? 1 : 2;");
   verifyFormat("x ? 1 : 2;");
Index: clang/lib/Format/FormatTokenLexer.cpp
===
--- clang/lib/Format/FormatTokenLexer.cpp
+++ clang/lib/Format/FormatTokenLexer.cpp
@@ -100,6 +100,10 @@
 static const tok::TokenKind JSExponentiation[] = {tok::star, tok::star};
 static const tok::TokenKind JSExponentiationEqual[] = {tok::star,
tok::starequal};
+static const tok::TokenKind JSNullPropagatingOperator[] = {tok::question,
+   tok::period};
+static const tok::TokenKind JSNullishOperator[] = {tok::question,
+   tok::question};
 
 // FIXME: Investigate what token type gives the correct operator priority.
 if (tryMergeTokens(JSIdentity, TT_BinaryOperator))
@@ -116,6 +120,14 @@
   Tokens.back()->Tok.setKind(tok::starequal);
   return;
 }
+if (tryMergeTokens(JSNullishOperator, TT_JsNullishCoalescingOperator))
+  return;
+if (tryMergeTokens(JSNullPropagatingOperator,
+   TT_JsNullPropagatingOperator)) {
+  // Treat like a regular "." access.
+  Tokens.back()->Tok.setKind(tok::period);
+  return;
+}
 if (tryMergeJSPrivateIdentifier())
   return;
   }
Index: clang/lib/Format/FormatToken.h
===
--- clang/lib/Format/FormatToken.h
+++ clang/lib/Format/FormatToken.h
@@ -60,6 +60,8 @@
   TYPE(JsExponentiationEqual)  
\
   TYPE(JsFatArrow) 
\
   TYPE(JsNonNullAssertion) 
\
+  TYPE(JsNullishCoalescingOperator)
\
+  TYPE(JsNullPropagatingOperator)  
\
   TYPE(JsPrivateIdentifier)
\
   TYPE(JsTypeColon)
\
   TYPE(JsTypeOperator) 
\


Index: clang/unittests/Format/FormatTestJS.cpp
===
--- clang/unittests/Format/FormatTestJS.cpp
+++ clang/unittests/Format/FormatTestJS.cpp
@@ -,6 +,16 @@
   verifyFormat("return !!x;\n");
 }
 
+TEST_F(FormatTestJS, NullPropagatingOperator) {
+  verifyFormat("let x = foo?.bar?.baz();\n");
+  verifyFormat("let x = foo?.(foo);\n");
+  verifyFormat("let x = foo?.['arr'];\n");
+}
+
+TEST_F(FormatTestJS, NullishCoalescingOperator) {
+  verifyFormat("const val = something ?? 'some other default';\n");
+}
+
 TEST_F(FormatTestJS, Conditional) {
   verifyFormat("y = x ? 1 : 2;");
   verifyFormat("x ? 1 : 2;");
Index: clang/lib/Format/FormatTokenLexer.cpp
===
--- clang/lib/Format/FormatTokenLexer.cpp
+++ clang/lib/Format/FormatTokenLexer.cpp
@@ -100,6 +100,10 @@
 static const tok::TokenKind JSExponentiation[] = {tok::star, tok::star};
 static const tok::TokenKind JSExponentiationEqual[] = {tok::star,
tok::starequal};
+static const tok::TokenKind JSNullPropagatingOperator[] = {tok::question,
+   tok::period};
+static const tok::TokenKind JSNullishOperator[] = {tok::question,
+   tok::question};
 
 // FIXME: Investigate what token type gives the correct operator priority.
 if (tryMergeTokens(JSIdentity, TT_BinaryOperator))
@@ -116,6 +120,14 @@
   Tokens.back()->Tok.setKind(tok::starequal);
   return;
 }
+if (tryMergeTokens(JSNullishOperator, TT_JsNullishCoalescingOperator))
+  r

  1   2   >