[PATCH] D68969: [clang-format] Remove the dependency on frontend

2019-10-14 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: thakis, klimek, mitchell-stellar.
MyDeveloperDay added projects: clang, clang-format.
Herald added a subscriber: mgorny.

Address review comments from D68554: [clang-format] Proposal for clang-format 
to give compiler style warnings  by trying to 
drop the dependency again on Frontend whilst keeping the same format diagnostic 
messages

Not completely happy with having to do a split in order to get the StringRef 
for the Line the error occurred on, but could see a way to use SourceManager 
and SourceLocation to give me a single line?

But this removes the dependency on frontend which should keep the binary size 
down.


Repository:
  rC Clang

https://reviews.llvm.org/D68969

Files:
  clang/tools/clang-format/CMakeLists.txt
  clang/tools/clang-format/ClangFormat.cpp


Index: clang/tools/clang-format/ClangFormat.cpp
===
--- clang/tools/clang-format/ClangFormat.cpp
+++ clang/tools/clang-format/ClangFormat.cpp
@@ -18,7 +18,6 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
-#include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
@@ -325,12 +324,9 @@
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
   DiagOpts->ShowColors = (ShowColors && !NoShowColors);
 
-  TextDiagnosticPrinter *DiagsBuffer =
-  new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts, false);
-
   IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
   IntrusiveRefCntPtr Diags(
-  new DiagnosticsEngine(DiagID, &*DiagOpts, DiagsBuffer));
+  new DiagnosticsEngine(DiagID, &*DiagOpts));
 
   IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
@@ -339,24 +335,35 @@
   FileID FileID = createInMemoryFile(AssumedFileName, Code.get(), Sources,
  Files, InMemoryFileSystem.get());
 
-  const unsigned ID = Diags->getCustomDiagID(
-  WarningsAsErrors ? clang::DiagnosticsEngine::Error
-   : clang::DiagnosticsEngine::Warning,
-  "code should be clang-formatted [-Wclang-format-violations]");
+  SmallVector Lines;
+  Code->getBuffer().split(Lines, "\n", /*MaxSplit=*/-1,
+  /*KeepEmpty=*/true);
 
   unsigned Errors = 0;
-  DiagsBuffer->BeginSourceFile(LangOptions(), nullptr);
   if (WarnFormat && !NoWarnFormat) {
+ArrayRef> Ranges;
 for (const auto  : Replaces) {
-  Diags->Report(
-  Sources.getLocForStartOfFile(FileID).getLocWithOffset(R.getOffset()),
-  ID);
+  PresumedLoc PLoc = Sources.getPresumedLoc(
+  
Sources.getLocForStartOfFile(FileID).getLocWithOffset(R.getOffset()));
+
+  StringRef Line;
+  if (PLoc.getLine() < Lines.size() && PLoc.getLine() > 0)
+Line = Lines[PLoc.getLine() - 1];
+
+  SMDiagnostic Diags(
+  llvm::SourceMgr(), SMLoc(), AssumedFileName, PLoc.getLine(),
+  PLoc.getColumn() - 1,
+  WarningsAsErrors ? SourceMgr::DiagKind::DK_Error
+   : SourceMgr::DiagKind::DK_Warning,
+  "code should be clang-formatted [-Wclang-format-violations]", Line,
+  ArrayRef>());
+
+  Diags.print(nullptr, llvm::errs(), (ShowColors && !NoShowColors));
   Errors++;
   if (ErrorLimit && Errors >= ErrorLimit)
 break;
 }
   }
-  DiagsBuffer->EndSourceFile();
   return WarningsAsErrors;
 }
 
Index: clang/tools/clang-format/CMakeLists.txt
===
--- clang/tools/clang-format/CMakeLists.txt
+++ clang/tools/clang-format/CMakeLists.txt
@@ -7,7 +7,6 @@
 set(CLANG_FORMAT_LIB_DEPS
   clangBasic
   clangFormat
-  clangFrontend
   clangRewrite
   clangToolingCore
   )


Index: clang/tools/clang-format/ClangFormat.cpp
===
--- clang/tools/clang-format/ClangFormat.cpp
+++ clang/tools/clang-format/ClangFormat.cpp
@@ -18,7 +18,6 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Format/Format.h"
-#include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
@@ -325,12 +324,9 @@
   IntrusiveRefCntPtr DiagOpts = new DiagnosticOptions();
   DiagOpts->ShowColors = (ShowColors && !NoShowColors);
 
-  TextDiagnosticPrinter *DiagsBuffer =
-  new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts, false);
-
   IntrusiveRefCntPtr DiagID(new DiagnosticIDs());
   IntrusiveRefCntPtr Diags(
-  new DiagnosticsEngine(DiagID, &*DiagOpts, DiagsBuffer));
+  new DiagnosticsEngine(DiagID, &*DiagOpts));
 
   IntrusiveRefCntPtr InMemoryFileSystem(
   new llvm::vfs::InMemoryFileSystem);
@@ -339,24 +335,35 @@
   

Zorg migration to GitHub/monorepo

2019-10-14 Thread Galina Kistanova via cfe-commits
Hello everyone,



We are in the middle of porting the majority of zorg to
GitHub/monorepo. The following build factories will be ported and if you
use one of those for your bots, you are all covered:



* ClangBuilder.getClangCMakeBuildFactory (31 bots)

* ClangBuilder.getClangCMakeGCSBuildFactory (2 bots)

* LibcxxAndAbiBuilder (23 bots)

* SphinxDocsBuilder (7 bots)

* UnifiedTreeBuilder (11 bots)

* ABITestsuitBuilder (1 bot) - based on UnifiedTreeBuilder

* ClangLTOBuilder (2 bots) - based on UnifiedTreeBuilder

* LLDPerformanceTesuiteBuilder (1 bot) - based on UnifiedTreeBuilder



Some build factories will be deprecated. If you use one of these, please
change your bot to use something else instead. Here is the list of
deprecated build factories:



* ClangBuilder.getClangBuildFactory (0 bots)

* LLDBuilder (0 bots)

* ClangAndLLDBuilder (0 bots)



However, some special build factories and build factories with a few bots
would need your attention.

Here is the list of build factories in need of porting. Patches are welcome.



* LLVMBuilder (3 bots)

* PollyBuilder (3 bots)

* LLDBBuilder (6 bots)

* SanitizerBuilder (10 bots)

* CUDATestsuiteBuilder (1 bot) - depends on
ClangBuilder.getClangBuildFactory

* AOSPBuilder (1 bot) - depends on PollyBuilder

* AnnotatedBuilder (2 bots)

* OpenMPBuilder (2 bots)

* FuchsiaBuilder (1 bot)



Please feel free to ask if you have questions.



Thanks



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


[PATCH] D68902: [WebAssembly] Trapping fptoint builtins and intrinsics

2019-10-14 Thread Thomas Lively via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG232fd99d9ee6: [WebAssembly] Trapping fptoint builtins and 
intrinsics (authored by tlively).

Changed prior to commit:
  https://reviews.llvm.org/D68902?vs=224718=224945#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68902

Files:
  clang/include/clang/Basic/BuiltinsWebAssembly.def
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/builtins-wasm.c
  llvm/include/llvm/IR/IntrinsicsWebAssembly.td
  llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td
  llvm/test/CodeGen/WebAssembly/conv-trap.ll

Index: llvm/test/CodeGen/WebAssembly/conv-trap.ll
===
--- llvm/test/CodeGen/WebAssembly/conv-trap.ll
+++ llvm/test/CodeGen/WebAssembly/conv-trap.ll
@@ -165,3 +165,83 @@
   %a = fptoui double %x to i64
   ret i64 %a
 }
+
+; CHECK-LABEL: llvm_wasm_trunc_signed_i32_f32:
+; CHECK-NEXT: .functype llvm_wasm_trunc_signed_i32_f32 (f32) -> (i32)
+; CHECK-NEXT: i32.trunc_f32_s $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i32 @llvm.wasm.trunc.signed.i32.f32(float)
+define i32 @llvm_wasm_trunc_signed_i32_f32(float %f) {
+  %a = call i32 @llvm.wasm.trunc.signed.i32.f32(float %f)
+  ret i32 %a
+}
+
+; CHECK-LABEL: llvm_wasm_trunc_unsigned_i32_f32:
+; CHECK-NEXT: .functype llvm_wasm_trunc_unsigned_i32_f32 (f32) -> (i32)
+; CHECK-NEXT: i32.trunc_f32_u $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i32 @llvm.wasm.trunc.unsigned.i32.f32(float)
+define i32 @llvm_wasm_trunc_unsigned_i32_f32(float %f) {
+  %a = call i32 @llvm.wasm.trunc.unsigned.i32.f32(float %f)
+  ret i32 %a
+}
+
+; CHECK-LABEL: llvm_wasm_trunc_signed_i32_f64:
+; CHECK-NEXT: .functype llvm_wasm_trunc_signed_i32_f64 (f64) -> (i32)
+; CHECK-NEXT: i32.trunc_f64_s $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i32 @llvm.wasm.trunc.signed.i32.f64(double)
+define i32 @llvm_wasm_trunc_signed_i32_f64(double %f) {
+  %a = call i32 @llvm.wasm.trunc.signed.i32.f64(double %f)
+  ret i32 %a
+}
+
+; CHECK-LABEL: llvm_wasm_trunc_unsigned_i32_f64:
+; CHECK-NEXT: .functype llvm_wasm_trunc_unsigned_i32_f64 (f64) -> (i32)
+; CHECK-NEXT: i32.trunc_f64_u $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i32 @llvm.wasm.trunc.unsigned.i32.f64(double)
+define i32 @llvm_wasm_trunc_unsigned_i32_f64(double %f) {
+  %a = call i32 @llvm.wasm.trunc.unsigned.i32.f64(double %f)
+  ret i32 %a
+}
+
+; CHECK-LABEL: llvm_wasm_trunc_signed_i64_f32:
+; CHECK-NEXT: .functype llvm_wasm_trunc_signed_i64_f32 (f32) -> (i64)
+; CHECK-NEXT: i64.trunc_f32_s $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i64 @llvm.wasm.trunc.signed.i64.f32(float)
+define i64 @llvm_wasm_trunc_signed_i64_f32(float %f) {
+  %a = call i64 @llvm.wasm.trunc.signed.i64.f32(float %f)
+  ret i64 %a
+}
+
+; CHECK-LABEL: llvm_wasm_trunc_unsigned_i64_f32:
+; CHECK-NEXT: .functype llvm_wasm_trunc_unsigned_i64_f32 (f32) -> (i64)
+; CHECK-NEXT: i64.trunc_f32_u $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i64 @llvm.wasm.trunc.unsigned.i64.f32(float)
+define i64 @llvm_wasm_trunc_unsigned_i64_f32(float %f) {
+  %a = call i64 @llvm.wasm.trunc.unsigned.i64.f32(float %f)
+  ret i64 %a
+}
+
+; CHECK-LABEL: llvm_wasm_trunc_signed_i64_f64:
+; CHECK-NEXT: .functype llvm_wasm_trunc_signed_i64_f64 (f64) -> (i64)
+; CHECK-NEXT: i64.trunc_f64_s $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i64 @llvm.wasm.trunc.signed.i64.f64(double)
+define i64 @llvm_wasm_trunc_signed_i64_f64(double %f) {
+  %a = call i64 @llvm.wasm.trunc.signed.i64.f64(double %f)
+  ret i64 %a
+}
+
+; CHECK-LABEL: llvm_wasm_trunc_unsigned_i64_f64:
+; CHECK-NEXT: .functype llvm_wasm_trunc_unsigned_i64_f64 (f64) -> (i64)
+; CHECK-NEXT: i64.trunc_f64_u $push[[L0:[0-9]+]]=, $0{{$}}
+; CHECK-NEXT: return $pop[[L0]]{{$}}
+declare i64 @llvm.wasm.trunc.unsigned.i64.f64(double)
+define i64 @llvm_wasm_trunc_unsigned_i64_f64(double %f) {
+  %a = call i64 @llvm.wasm.trunc.unsigned.i64.f64(double %f)
+  ret i64 %a
+}
Index: llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td
===
--- llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td
+++ llvm/lib/Target/WebAssembly/WebAssemblyInstrConv.td
@@ -171,6 +171,23 @@
  0xb1>;
 } // hasSideEffects = 1
 
+def : Pat<(int_wasm_trunc_signed F32:$src),
+  (I32_TRUNC_S_F32 F32:$src)>;
+def : Pat<(int_wasm_trunc_unsigned F32:$src),
+  (I32_TRUNC_U_F32 F32:$src)>;
+def : Pat<(int_wasm_trunc_signed F64:$src),
+  (I32_TRUNC_S_F64 F64:$src)>;
+def : Pat<(int_wasm_trunc_unsigned F64:$src),
+  (I32_TRUNC_U_F64 F64:$src)>;
+def : Pat<(int_wasm_trunc_signed F32:$src),
+  (I64_TRUNC_S_F32 F32:$src)>;
+def : 

r374856 - [WebAssembly] Trapping fptoint builtins and intrinsics

2019-10-14 Thread Thomas Lively via cfe-commits
Author: tlively
Date: Mon Oct 14 18:11:51 2019
New Revision: 374856

URL: http://llvm.org/viewvc/llvm-project?rev=374856=rev
Log:
[WebAssembly] Trapping fptoint builtins and intrinsics

Summary:
The WebAssembly backend lowers fptoint instructions to a code sequence
that checks for overflow to avoid traps because fptoint is supposed to
be speculatable. These new builtins and intrinsics give users a way to
depend on the trapping semantics of the underlying instructions and
avoid the extra code generated normally.

Patch by coffee and tlively.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, 
cfe-commits, llvm-commits

Tags: #clang, #llvm

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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/builtins-wasm.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def?rev=374856=374855=374856=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsWebAssembly.def Mon Oct 14 18:11:51 
2019
@@ -49,6 +49,16 @@ BUILTIN(__builtin_wasm_atomic_wait_i32,
 BUILTIN(__builtin_wasm_atomic_wait_i64, "iLLi*LLiLLi", "n")
 BUILTIN(__builtin_wasm_atomic_notify, "Uii*Ui", "n")
 
+// Trapping fp-to-int conversions
+BUILTIN(__builtin_wasm_trunc_s_i32_f32, "if", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i32_f32, "if", "nc")
+BUILTIN(__builtin_wasm_trunc_s_i32_f64, "id", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i32_f64, "id", "nc")
+BUILTIN(__builtin_wasm_trunc_s_i64_f32, "LLif", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i64_f32, "LLif", "nc")
+BUILTIN(__builtin_wasm_trunc_s_i64_f64, "LLid", "nc")
+BUILTIN(__builtin_wasm_trunc_u_i64_f64, "LLid", "nc")
+
 // Saturating fp-to-int conversions
 TARGET_BUILTIN(__builtin_wasm_trunc_saturate_s_i32_f32, "if", "nc", 
"nontrapping-fptoint")
 TARGET_BUILTIN(__builtin_wasm_trunc_saturate_u_i32_f32, "if", "nc", 
"nontrapping-fptoint")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=374856=374855=374856=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 14 18:11:51 2019
@@ -14020,6 +14020,26 @@ Value *CodeGenFunction::EmitWebAssemblyB
 Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_atomic_notify);
 return Builder.CreateCall(Callee, {Addr, Count});
   }
+  case WebAssembly::BI__builtin_wasm_trunc_s_i32_f32:
+  case WebAssembly::BI__builtin_wasm_trunc_s_i32_f64:
+  case WebAssembly::BI__builtin_wasm_trunc_s_i64_f32:
+  case WebAssembly::BI__builtin_wasm_trunc_s_i64_f64: {
+Value *Src = EmitScalarExpr(E->getArg(0));
+llvm::Type *ResT = ConvertType(E->getType());
+Function *Callee =
+CGM.getIntrinsic(Intrinsic::wasm_trunc_signed, {ResT, Src->getType()});
+return Builder.CreateCall(Callee, {Src});
+  }
+  case WebAssembly::BI__builtin_wasm_trunc_u_i32_f32:
+  case WebAssembly::BI__builtin_wasm_trunc_u_i32_f64:
+  case WebAssembly::BI__builtin_wasm_trunc_u_i64_f32:
+  case WebAssembly::BI__builtin_wasm_trunc_u_i64_f64: {
+Value *Src = EmitScalarExpr(E->getArg(0));
+llvm::Type *ResT = ConvertType(E->getType());
+Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_trunc_unsigned,
+{ResT, Src->getType()});
+return Builder.CreateCall(Callee, {Src});
+  }
   case WebAssembly::BI__builtin_wasm_trunc_saturate_s_i32_f32:
   case WebAssembly::BI__builtin_wasm_trunc_saturate_s_i32_f64:
   case WebAssembly::BI__builtin_wasm_trunc_saturate_s_i64_f32:

Modified: cfe/trunk/test/CodeGen/builtins-wasm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-wasm.c?rev=374856=374855=374856=diff
==
--- cfe/trunk/test/CodeGen/builtins-wasm.c (original)
+++ cfe/trunk/test/CodeGen/builtins-wasm.c Mon Oct 14 18:11:51 2019
@@ -85,6 +85,54 @@ unsigned int atomic_notify(int *addr, un
   // WEBASSEMBLY64: call i32 @llvm.wasm.atomic.notify(i32* %{{.*}}, i32 
%{{.*}})
 }
 
+int trunc_s_i32_f32(float f) {
+  return __builtin_wasm_trunc_s_i32_f32(f);
+  // WEBASSEMBLY: call i32 @llvm.wasm.trunc.signed.i32.f32(float %f)
+  // WEBASSEMBLY-NEXT: ret
+}
+
+int trunc_u_i32_f32(float f) {
+  return __builtin_wasm_trunc_u_i32_f32(f);
+  // WEBASSEMBLY: call i32 @llvm.wasm.trunc.unsigned.i32.f32(float %f)
+  // WEBASSEMBLY-NEXT: ret
+}
+
+int trunc_s_i32_f64(double f) {
+  return __builtin_wasm_trunc_s_i32_f64(f);
+  // WEBASSEMBLY: call i32 @llvm.wasm.trunc.signed.i32.f64(double %f)
+  // WEBASSEMBLY-NEXT: ret
+}
+
+int trunc_u_i32_f64(double f) 

LLVM buildmaster will be updated tonight

2019-10-14 Thread Galina Kistanova via cfe-commits
 Hello everyone,

LLVM buildmaster will be updated and restarted after 7PM Pacific time today.

Thank

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


Re: [llvm-dev] Attention bot owners

2019-10-14 Thread Galina Kistanova via cfe-commits
Hi Diana,

git 2.7.4 should be fine.

Thanks

Galina


On Mon, Oct 14, 2019 at 12:57 AM Diana Picus  wrote:

> Hi Galina,
>
> Thanks for the heads up.
>
> On Fri, 11 Oct 2019 at 21:09, Galina Kistanova via llvm-dev
>  wrote:
> >
> > Hello all bots owners,
> >
> > As all of you know we move to github monorepo very soon now.
> > We are actively working on the buildbot to prepare a solution to switch
> from SVN to github when time comes.
> >
> > It would require some activity on your bots.
> >
> > At this point it is clear that you would need to
> >
> > * Make sure you have reasonably recent version of git installed and in
> the system path for the buildbot account,
>
> What qualifies as reasonably recent? Does git 2.7.4 suffice?
>
> Thanks,
> Diana
>
> > * Once the transition to github is done, you would need to remove the
> old source code and build directory. This could be done later assuming you
> have enough room on that hard drive for two sets of the source and build
> files.
> >
> > Thanks
> >
> > Galina
> > ___
> > LLVM Developers mailing list
> > llvm-...@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

2019-10-14 Thread Ana Pazos via Phabricator via cfe-commits
apazos added a comment.

Yes Eli thanks for pointing out  there are more scenarios that can fail.
It looks like the best solution is to permit both flags on, but then bail out 
from doing this transformation if there is any type of tail call already in the 
function.
This way we avoid messing with reverting tail calls back to regular calls.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686



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


[PATCH] D50360: [Concepts] Requires Expressions

2019-10-14 Thread Saar Raz via Phabricator via cfe-commits
saar.raz added inline comments.



Comment at: lib/AST/StmtProfile.cpp:1325
+  //expression. It is equivalent to the simple-requirement x++; [...]
+  // We therefore do not profile isSimple() here.
+  ID.AddBoolean(ExprReq->getNoexceptLoc().isValid());

rsmith wrote:
> We don't /need to/ profile `isSimple`, but we still could. (This "is 
> equivalent to" doesn't override the general ODR requirement that you spell 
> the expression with the same token sequence.)
> 
> Do we mangle simple and compound requirements the same way? (Has a mangling 
> for requires-expressions even been proposed on the Itanium ABI list yet?)
Not yet :(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D50360



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


[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D67723#1708671 , @aprantl wrote:

> Who is "we" in this context? The CodeView backend?


Yes, the CodeView backend, sorry for the ambiguity.

> As far as DWARF is concerned (and LLVM mostly inherits the DWARF semantics) 
> line 0 is well-defined and means compiler-generated code or otherwise no 
> unambiguous source location. DWARF-based debuggers know to skip over 
> instructions with line 0.
> 
> Is the problem that CodeView doesn't have this concept, or does the Windows 
> debugger no know how to deal with it (or both)?

Visual Studio in particular has been reported to have problems with line zero. 
It seems to treat it as some kind of error condition (no line available), and 
kicks the user over to the assembly view.

> I'm feeling rather strongly that that LLVM should not be emitting wrong debug 
> info to work around bugs in a debugger. I understand that sometimes this 
> isn't possible because we don't control the consumers. The correct thing to 
> do here is to guard the workaround by a debugger tuning flag. For DWARF, we 
> do want line 0 here.

I don't think we want to emit line zero here. The use case for this flag is to 
allow the user to ask the compiler to attribute code from inlined call sites to 
the call site itself. Maybe the user doesn't want to see the details of 
push_back.

I actually went ahead and experimented with how gdb handles line zero. I 
compiled the following program like so:

  $ cat t.cpp
  volatile int x;
  static inline void foo() {
++x;
++x;
  }
  int main() {
++x;
foo();
++x;
foo();
++x;
return x;
  }
  $ clang -g -O2 t.cpp -S -emit-llvm -o t.ll
  $ sed -e 's/DILocation.line:.*column:.*, scope\(.*inlinedAt: 
.*\))/DILocation(line: 0, column: 0, scope\1)/' -i t.ll
  $ clang -g t.ll -o t.exe
  $ gdb --args t.exe
  ...

When I step through main with `s` in gdb, it stops on the `++x` lines, and 
skips the `foo()` lines completely. I don't think that's the desired behavior, 
the desired behavior is to treat the body of `foo` as a single line.

To give more context, back in 2013, @probinson asked if we should add a similar 
feature here:
http://lists.llvm.org/pipermail/cfe-dev/2013-November/033765.html
This was around the time that inlinedAt locations were being sorted out, I 
think. His proposed name for this flag was -gno-inlined-scopes. I believe 
nothing ever came of that discussion, and we continued on our way until today 
in 2019, when one of our users requested a similar feature. I vaguely recalled 
the discussion from 2013, but I had forgotten the details, so I figured that it 
might be a generally useful feature that others would appreciate. So, I 
suggested that @akhuang add a real flag for it, and that it should work for 
DWARF and CodeView. That's part of why I figured it would be good to implement 
it in the inliner, so we don't have to do the work twice.

Given the behavior of gdb shown above, I don't think either set of users, 
Chromium developers or Sony licensees, have a use case for a flag that applies 
line zero to inlined functions. I don't think that's what they are asking for. 
Paul outlined what users actually asked for back then here:
http://lists.llvm.org/pipermail/cfe-dev/2013-November/033782.html

I think users are asking for a flag that attributes the code that the inliner 
clones to the call site. And, I can't see any reason not to give it to them. 
Does that seem reasonable?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67723



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


Re: r374844 - Revert "Dead Virtual Function Elimination"

2019-10-14 Thread Richard Smith via cfe-commits
Hi Jorge,

Please mention the reason for a revert in revert commit messages. Also,
until SVN stops being our system of record, please use SVN revision numbers
to reference prior commits in reverts.

On Mon, 14 Oct 2019 at 16:22, Jorge Gorbe Moya via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jgorbe
> Date: Mon Oct 14 16:25:25 2019
> New Revision: 374844
>
> URL: http://llvm.org/viewvc/llvm-project?rev=374844=rev
> Log:
> Revert "Dead Virtual Function Elimination"
>
> This reverts commit 9f6a873268e1ad9855873d9d8007086c0d01cf4f.
>
> Removed:
> cfe/trunk/test/CodeGenCXX/vcall-visibility-metadata.cpp
> cfe/trunk/test/CodeGenCXX/virtual-function-elimination.cpp
> cfe/trunk/test/Driver/virtual-function-elimination.cpp
> Modified:
> cfe/trunk/include/clang/Basic/CodeGenOptions.def
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/lib/CodeGen/CGClass.cpp
> cfe/trunk/lib/CodeGen/CGVTables.cpp
> cfe/trunk/lib/CodeGen/CodeGenModule.h
> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>
> Modified: cfe/trunk/include/clang/Basic/CodeGenOptions.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CodeGenOptions.def?rev=374844=374843=374844=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/CodeGenOptions.def (original)
> +++ cfe/trunk/include/clang/Basic/CodeGenOptions.def Mon Oct 14 16:25:25
> 2019
> @@ -278,10 +278,6 @@ CODEGENOPT(EmitLLVMUseLists, 1, 0) ///<
>  CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program
>///  vtable optimization.
>
> -CODEGENOPT(VirtualFunctionElimination, 1, 0) ///< Whether to apply the
> dead
> - /// virtual function
> elimination
> - /// optimization.
> -
>  /// Whether to use public LTO visibility for entities in std and stdext
>  /// namespaces. This is enabled by clang-cl's /MT and /MTd flags.
>  CODEGENOPT(LTOVisibilityPublicStd, 1, 0)
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374844=374843=374844=diff
>
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 14 16:25:25 2019
> @@ -1863,13 +1863,6 @@ def fforce_emit_vtables : Flag<["-"], "f
>  HelpText<"Emits more virtual tables to improve devirtualization">;
>  def fno_force_emit_vtables : Flag<["-"], "fno-force-emit-vtables">,
> Group,
>Flags<[CoreOption]>;
> -
> -def fvirtual_function_elimination : Flag<["-"],
> "fvirtual-function-elimination">, Group,
> -  Flags<[CoreOption, CC1Option]>,
> -  HelpText<"Enables dead virtual function elimination optimization.
> Requires -flto=full">;
> -def fno_virtual_function_elimination : Flag<["-"],
> "fno-virtual-function_elimination">, Group,
> -  Flags<[CoreOption]>;
> -
>  def fwrapv : Flag<["-"], "fwrapv">, Group, Flags<[CC1Option]>,
>HelpText<"Treat signed integer overflow as two's complement">;
>  def fwritable_strings : Flag<["-"], "fwritable-strings">, Group,
> Flags<[CC1Option]>,
>
> Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=374844=374843=374844=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon Oct 14 16:25:25 2019
> @@ -2784,16 +2784,11 @@ void CodeGenFunction::EmitVTablePtrCheck
>
>  bool CodeGenFunction::ShouldEmitVTableTypeCheckedLoad(const CXXRecordDecl
> *RD) {
>if (!CGM.getCodeGenOpts().WholeProgramVTables ||
> +  !SanOpts.has(SanitizerKind::CFIVCall) ||
> +  !CGM.getCodeGenOpts().SanitizeTrap.has(SanitizerKind::CFIVCall) ||
>!CGM.HasHiddenLTOVisibility(RD))
>  return false;
>
> -  if (CGM.getCodeGenOpts().VirtualFunctionElimination)
> -return true;
> -
> -  if (!SanOpts.has(SanitizerKind::CFIVCall) ||
> -  !CGM.getCodeGenOpts().SanitizeTrap.has(SanitizerKind::CFIVCall))
> -return false;
> -
>std::string TypeName = RD->getQualifiedNameAsString();
>return !getContext().getSanitizerBlacklist().isBlacklistedType(
>SanitizerKind::CFIVCall, TypeName);
> @@ -2816,13 +2811,8 @@ llvm::Value *CodeGenFunction::EmitVTable
> TypeId});
>llvm::Value *CheckResult = Builder.CreateExtractValue(CheckedLoad, 1);
>
> -  std::string TypeName = RD->getQualifiedNameAsString();
> -  if (SanOpts.has(SanitizerKind::CFIVCall) &&
> -  !getContext().getSanitizerBlacklist().isBlacklistedType(
> -  SanitizerKind::CFIVCall, TypeName)) {
> -

r374844 - Revert "Dead Virtual Function Elimination"

2019-10-14 Thread Jorge Gorbe Moya via cfe-commits
Author: jgorbe
Date: Mon Oct 14 16:25:25 2019
New Revision: 374844

URL: http://llvm.org/viewvc/llvm-project?rev=374844=rev
Log:
Revert "Dead Virtual Function Elimination"

This reverts commit 9f6a873268e1ad9855873d9d8007086c0d01cf4f.

Removed:
cfe/trunk/test/CodeGenCXX/vcall-visibility-metadata.cpp
cfe/trunk/test/CodeGenCXX/virtual-function-elimination.cpp
cfe/trunk/test/Driver/virtual-function-elimination.cpp
Modified:
cfe/trunk/include/clang/Basic/CodeGenOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Basic/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/CodeGenOptions.def?rev=374844=374843=374844=diff
==
--- cfe/trunk/include/clang/Basic/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Basic/CodeGenOptions.def Mon Oct 14 16:25:25 2019
@@ -278,10 +278,6 @@ CODEGENOPT(EmitLLVMUseLists, 1, 0) ///<
 CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program
   ///  vtable optimization.
 
-CODEGENOPT(VirtualFunctionElimination, 1, 0) ///< Whether to apply the dead
- /// virtual function elimination
- /// optimization.
-
 /// Whether to use public LTO visibility for entities in std and stdext
 /// namespaces. This is enabled by clang-cl's /MT and /MTd flags.
 CODEGENOPT(LTOVisibilityPublicStd, 1, 0)

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374844=374843=374844=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 14 16:25:25 2019
@@ -1863,13 +1863,6 @@ def fforce_emit_vtables : Flag<["-"], "f
 HelpText<"Emits more virtual tables to improve devirtualization">;
 def fno_force_emit_vtables : Flag<["-"], "fno-force-emit-vtables">, 
Group,
   Flags<[CoreOption]>;
-
-def fvirtual_function_elimination : Flag<["-"], 
"fvirtual-function-elimination">, Group,
-  Flags<[CoreOption, CC1Option]>,
-  HelpText<"Enables dead virtual function elimination optimization. Requires 
-flto=full">;
-def fno_virtual_function_elimination : Flag<["-"], 
"fno-virtual-function_elimination">, Group,
-  Flags<[CoreOption]>;
-
 def fwrapv : Flag<["-"], "fwrapv">, Group, Flags<[CC1Option]>,
   HelpText<"Treat signed integer overflow as two's complement">;
 def fwritable_strings : Flag<["-"], "fwritable-strings">, Group, 
Flags<[CC1Option]>,

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=374844=374843=374844=diff
==
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Mon Oct 14 16:25:25 2019
@@ -2784,16 +2784,11 @@ void CodeGenFunction::EmitVTablePtrCheck
 
 bool CodeGenFunction::ShouldEmitVTableTypeCheckedLoad(const CXXRecordDecl *RD) 
{
   if (!CGM.getCodeGenOpts().WholeProgramVTables ||
+  !SanOpts.has(SanitizerKind::CFIVCall) ||
+  !CGM.getCodeGenOpts().SanitizeTrap.has(SanitizerKind::CFIVCall) ||
   !CGM.HasHiddenLTOVisibility(RD))
 return false;
 
-  if (CGM.getCodeGenOpts().VirtualFunctionElimination)
-return true;
-
-  if (!SanOpts.has(SanitizerKind::CFIVCall) ||
-  !CGM.getCodeGenOpts().SanitizeTrap.has(SanitizerKind::CFIVCall))
-return false;
-
   std::string TypeName = RD->getQualifiedNameAsString();
   return !getContext().getSanitizerBlacklist().isBlacklistedType(
   SanitizerKind::CFIVCall, TypeName);
@@ -2816,13 +2811,8 @@ llvm::Value *CodeGenFunction::EmitVTable
TypeId});
   llvm::Value *CheckResult = Builder.CreateExtractValue(CheckedLoad, 1);
 
-  std::string TypeName = RD->getQualifiedNameAsString();
-  if (SanOpts.has(SanitizerKind::CFIVCall) &&
-  !getContext().getSanitizerBlacklist().isBlacklistedType(
-  SanitizerKind::CFIVCall, TypeName)) {
-EmitCheck(std::make_pair(CheckResult, SanitizerKind::CFIVCall),
-  SanitizerHandler::CFICheckFail, {}, {});
-  }
+  EmitCheck(std::make_pair(CheckResult, SanitizerKind::CFIVCall),
+SanitizerHandler::CFICheckFail, nullptr, nullptr);
 
   return Builder.CreateBitCast(
   Builder.CreateExtractValue(CheckedLoad, 0),

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=374844=374843=374844=diff

[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

2019-10-14 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

> Bug2: test case provided above. Please Lewis take a look at how this case can 
> be fixed.

Isn't the issue just that the code is checking for PseudoTAIL, and not 
PseudoTAILIndirect?



What happens if a tail call has more than 8 arguments?

What happens for a musttail call?  A tailcc call?  (Not sure if either of those 
are actually supported on RISCV at the moment?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686



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


Re: r374841 - [Modules][PCH] Hash input files content

2019-10-14 Thread Bruno Cardoso Lopes via cfe-commits
Thanks Eric!

On Mon, Oct 14, 2019 at 8:12 PM Eric Christopher  wrote:
>
> This was breaking a few bots and I couldn't find you on irc so I've
> reverted it thusly:
>
> echristo@jhereg ~/s/llvm-project> git llvm push
> Pushing 1 commit:
>   175b1b856ea Temporarily Revert [Modules][PCH] Hash input files
> content as it's breaking a few bots.
> Sendingcfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
> Sendingcfe/trunk/include/clang/Driver/Options.td
> Sendingcfe/trunk/include/clang/Lex/HeaderSearchOptions.h
> Sendingcfe/trunk/include/clang/Serialization/ASTBitCodes.h
> Sendingcfe/trunk/include/clang/Serialization/ASTReader.h
> Sendingcfe/trunk/lib/Driver/ToolChains/Clang.cpp
> Sendingcfe/trunk/lib/Frontend/CompilerInstance.cpp
> Sendingcfe/trunk/lib/Frontend/CompilerInvocation.cpp
> Sendingcfe/trunk/lib/Serialization/ASTReader.cpp
> Sendingcfe/trunk/lib/Serialization/ASTWriter.cpp
> Deleting   cfe/trunk/test/Modules/validate-file-content.m
> Deleting   cfe/trunk/test/PCH/validate-file-content.m
> Transmitting file data ..done
> Committing transaction...
> Committed revision 374842.
> Committed 175b1b856ea to svn.
>
> Sorry for the inconvenience!
>
> -eric
>
> On Mon, Oct 14, 2019 at 3:59 PM Bruno Cardoso Lopes via cfe-commits
>  wrote:
> >
> > Author: bruno
> > Date: Mon Oct 14 16:02:03 2019
> > New Revision: 374841
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=374841=rev
> > Log:
> > [Modules][PCH] Hash input files content
> >
> > Summary:
> > When files often get touched during builds, the mtime based validation
> > leads to different problems in implicit modules builds, even when the
> > content doesn't actually change:
> >
> > - Modules only: module invalidation due to out of date files. Usually 
> > causing rebuild traffic.
> > - Modules + PCH: build failures because clang cannot rebuild a module if it 
> > comes from building a PCH.
> > - PCH: build failures because clang cannot rebuild a PCH in case one of the 
> > input headers has different mtime.
> >
> > This patch proposes hashing the content of input files (headers and
> > module maps), which is performed during serialization time. When looking
> > at input files for validation, clang only computes the hash in case
> > there's a mtime mismatch.
> >
> > I've tested a couple of different hash algorithms availble in LLVM in
> > face of building modules+pch for `#import `:
> > - `hash_code`: performace diff within the noise, total module cache 
> > increased by 0.07%.
> > - `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be 
> > BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from 
> > `hash_code`.
> > - `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.
> >
> > Given the numbers above, the patch uses `hash_code`. The patch also
> > improves invalidation error msgs to point out which type of problem the
> > user is facing: "mtime", "size" or "content".
> >
> > rdar://problem/29320105
> >
> > Reviewers: dexonsmith, arphaman, rsmith, aprantl
> >
> > Subscribers: jkorous, cfe-commits, ributzka
> >
> > Tags: #clang
> >
> > Differential Revision: https://reviews.llvm.org/D67249
> >
> > Added:
> > cfe/trunk/test/Modules/validate-file-content.m
> > cfe/trunk/test/PCH/validate-file-content.m
> > Modified:
> > cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
> > cfe/trunk/include/clang/Driver/Options.td
> > cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
> > cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> > cfe/trunk/include/clang/Serialization/ASTReader.h
> > cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> > cfe/trunk/lib/Frontend/CompilerInstance.cpp
> > cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> > cfe/trunk/lib/Serialization/ASTReader.cpp
> > cfe/trunk/lib/Serialization/ASTWriter.cpp
> >
> > Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=374841=374840=374841=diff
> > ==
> > --- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
> > +++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Mon Oct 
> > 14 16:02:03 2019
> > @@ -18,13 +18,16 @@ def err_fe_pch_malformed : Error<
> >  def err_fe_pch_malformed_block : Error<
> >  "malformed block record in PCH file: '%0'">, DefaultFatal;
> >  def err_fe_pch_file_modified : Error<
> > -"file '%0' has been modified since the precompiled header '%1' was 
> > built">,
> > +"file '%0' has been modified since the precompiled header '%1' was 
> > built"
> > +": %select{size|mtime|content}2 changed">,
> >  DefaultFatal;
> >  def err_fe_module_file_modified : Error<
> > -"file '%0' has been modified since the module file 

Re: r374841 - [Modules][PCH] Hash input files content

2019-10-14 Thread Eric Christopher via cfe-commits
This was breaking a few bots and I couldn't find you on irc so I've
reverted it thusly:

echristo@jhereg ~/s/llvm-project> git llvm push
Pushing 1 commit:
  175b1b856ea Temporarily Revert [Modules][PCH] Hash input files
content as it's breaking a few bots.
Sendingcfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
Sendingcfe/trunk/include/clang/Driver/Options.td
Sendingcfe/trunk/include/clang/Lex/HeaderSearchOptions.h
Sendingcfe/trunk/include/clang/Serialization/ASTBitCodes.h
Sendingcfe/trunk/include/clang/Serialization/ASTReader.h
Sendingcfe/trunk/lib/Driver/ToolChains/Clang.cpp
Sendingcfe/trunk/lib/Frontend/CompilerInstance.cpp
Sendingcfe/trunk/lib/Frontend/CompilerInvocation.cpp
Sendingcfe/trunk/lib/Serialization/ASTReader.cpp
Sendingcfe/trunk/lib/Serialization/ASTWriter.cpp
Deleting   cfe/trunk/test/Modules/validate-file-content.m
Deleting   cfe/trunk/test/PCH/validate-file-content.m
Transmitting file data ..done
Committing transaction...
Committed revision 374842.
Committed 175b1b856ea to svn.

Sorry for the inconvenience!

-eric

On Mon, Oct 14, 2019 at 3:59 PM Bruno Cardoso Lopes via cfe-commits
 wrote:
>
> Author: bruno
> Date: Mon Oct 14 16:02:03 2019
> New Revision: 374841
>
> URL: http://llvm.org/viewvc/llvm-project?rev=374841=rev
> Log:
> [Modules][PCH] Hash input files content
>
> Summary:
> When files often get touched during builds, the mtime based validation
> leads to different problems in implicit modules builds, even when the
> content doesn't actually change:
>
> - Modules only: module invalidation due to out of date files. Usually causing 
> rebuild traffic.
> - Modules + PCH: build failures because clang cannot rebuild a module if it 
> comes from building a PCH.
> - PCH: build failures because clang cannot rebuild a PCH in case one of the 
> input headers has different mtime.
>
> This patch proposes hashing the content of input files (headers and
> module maps), which is performed during serialization time. When looking
> at input files for validation, clang only computes the hash in case
> there's a mtime mismatch.
>
> I've tested a couple of different hash algorithms availble in LLVM in
> face of building modules+pch for `#import `:
> - `hash_code`: performace diff within the noise, total module cache increased 
> by 0.07%.
> - `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be 
> BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from 
> `hash_code`.
> - `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.
>
> Given the numbers above, the patch uses `hash_code`. The patch also
> improves invalidation error msgs to point out which type of problem the
> user is facing: "mtime", "size" or "content".
>
> rdar://problem/29320105
>
> Reviewers: dexonsmith, arphaman, rsmith, aprantl
>
> Subscribers: jkorous, cfe-commits, ributzka
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D67249
>
> Added:
> cfe/trunk/test/Modules/validate-file-content.m
> cfe/trunk/test/PCH/validate-file-content.m
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/include/clang/Serialization/ASTReader.h
> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> cfe/trunk/lib/Frontend/CompilerInstance.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Serialization/ASTReader.cpp
> cfe/trunk/lib/Serialization/ASTWriter.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=374841=374840=374841=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Mon Oct 14 
> 16:02:03 2019
> @@ -18,13 +18,16 @@ def err_fe_pch_malformed : Error<
>  def err_fe_pch_malformed_block : Error<
>  "malformed block record in PCH file: '%0'">, DefaultFatal;
>  def err_fe_pch_file_modified : Error<
> -"file '%0' has been modified since the precompiled header '%1' was 
> built">,
> +"file '%0' has been modified since the precompiled header '%1' was built"
> +": %select{size|mtime|content}2 changed">,
>  DefaultFatal;
>  def err_fe_module_file_modified : Error<
> -"file '%0' has been modified since the module file '%1' was built">,
> +"file '%0' has been modified since the module file '%1' was built"
> +": %select{size|mtime|content}2 changed">,
>  DefaultFatal;
>  def err_fe_ast_file_modified : Error<
> -"file '%0' has been modified since the AST file '%1' was built">,
> +"file '%0' 

r374842 - Temporarily Revert [Modules][PCH] Hash input files content

2019-10-14 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Mon Oct 14 16:14:24 2019
New Revision: 374842

URL: http://llvm.org/viewvc/llvm-project?rev=374842=rev
Log:
Temporarily Revert [Modules][PCH] Hash input files content
as it's breaking a few bots.

This reverts r374841 (git commit 2a1386c81de504b5bda44fbecf3f7b4cdfd748fc)

Removed:
cfe/trunk/test/Modules/validate-file-content.m
cfe/trunk/test/PCH/validate-file-content.m
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=374842=374841=374842=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Mon Oct 14 
16:14:24 2019
@@ -18,16 +18,13 @@ def err_fe_pch_malformed : Error<
 def err_fe_pch_malformed_block : Error<
 "malformed block record in PCH file: '%0'">, DefaultFatal;
 def err_fe_pch_file_modified : Error<
-"file '%0' has been modified since the precompiled header '%1' was built"
-": %select{size|mtime|content}2 changed">,
+"file '%0' has been modified since the precompiled header '%1' was built">,
 DefaultFatal;
 def err_fe_module_file_modified : Error<
-"file '%0' has been modified since the module file '%1' was built"
-": %select{size|mtime|content}2 changed">,
+"file '%0' has been modified since the module file '%1' was built">,
 DefaultFatal;
 def err_fe_ast_file_modified : Error<
-"file '%0' has been modified since the AST file '%1' was built"
-": %select{size|mtime|content}2 changed">,
+"file '%0' has been modified since the AST file '%1' was built">,
 DefaultFatal;
 def err_fe_pch_file_overridden : Error<
 "file '%0' from the precompiled header has been overridden">;
@@ -402,8 +399,6 @@ def warn_module_uses_date_time : Warning
 def err_module_no_size_mtime_for_header : Error<
   "cannot emit module %0: %select{size|mtime}1 must be explicitly specified "
   "for missing header file \"%2\"">;
-def err_module_unable_to_hash_content : Error<
-  "failed to hash content for '%0' because memory buffer cannot be retrieved">;
 } // let CategoryName
 } // let Component
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374842=374841=374842=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 14 16:14:24 2019
@@ -1368,28 +1368,6 @@ def fmodules_validate_system_headers : F
   HelpText<"Validate the system headers that a module depends on when loading 
the module">;
 def fno_modules_validate_system_headers : Flag<["-"], 
"fno-modules-validate-system-headers">,
   Group, Flags<[DriverOption]>;
-
-def fvalidate_ast_input_files_content:
-  Flag <["-"], "fvalidate-ast-input-files-content">,
-  Group, Flags<[CC1Option]>,
-  HelpText<"Compute and store the hash of input files used to build an AST."
-   " Files with mismatching mtime's are considered valid"
-   " if both contents is identical">;
-def fmodules_validate_input_files_content:
-  Flag <["-"], "fmodules-validate-input-files-content">,
-  Group, Flags<[DriverOption]>,
-  HelpText<"Validate PCM input files based on content if mtime differs">;
-def fno_modules_validate_input_files_content:
-  Flag <["-"], "fno_modules-validate-input-files-content">,
-  Group, Flags<[DriverOption]>;
-def fpch_validate_input_files_content:
-  Flag <["-"], "fpch-validate-input-files-content">,
-  Group, Flags<[DriverOption]>,
-  HelpText<"Validate PCH input files based on content if mtime differs">;
-def fno_pch_validate_input_files_content:
-  Flag <["-"], "fno_pch-validate-input-files-content">,
-  Group, Flags<[DriverOption]>;
-
 def fmodules : Flag <["-"], "fmodules">, Group,
   Flags<[DriverOption, CC1Option]>,
   HelpText<"Enable the 'modules' language feature">;

Modified: cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearchOptions.h?rev=374842=374841=374842=diff
==
--- cfe/trunk/include/clang/Lex/HeaderSearchOptions.h (original)
+++ 

[PATCH] D67249: [Modules][PCH] Hash input files content

2019-10-14 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2a1386c81de5: [Modules][PCH] Hash input files content 
(authored by bruno).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67249

Files:
  clang/include/clang/Basic/DiagnosticSerializationKinds.td
  clang/include/clang/Driver/Options.td
  clang/include/clang/Lex/HeaderSearchOptions.h
  clang/include/clang/Serialization/ASTBitCodes.h
  clang/include/clang/Serialization/ASTReader.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/test/Modules/validate-file-content.m
  clang/test/PCH/validate-file-content.m

Index: clang/test/PCH/validate-file-content.m
===
--- /dev/null
+++ clang/test/PCH/validate-file-content.m
@@ -0,0 +1,29 @@
+// REQUIRES: shell
+//
+// Check driver works
+// RUN: %clang -x objective-c-header -fsyntax-only -fpch-validate-input-files-content %t/a.h -### 2>&1 | FileCheck --check-prefix=CHECK-CC1 %s
+// CHECK-CC1: -fvalidate-ast-input-files-content
+//
+// PCH only: Test that a mtime mismatch without content change is fine
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo '// m.h' > %t/m.h
+// RUN: echo '#include "m.h"' > %t/a.h
+// RUN: %clang_cc1 -emit-pch -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
+// RUN: touch -m -a -t 20290101 %t/m.h
+// RUN: %clang_cc1 -fsyntax-only -I %t -include-pch %t/a.pch %s -verify -fvalidate-ast-input-files-content
+//
+// PCH only: Test that a mtime mismatch with content change
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo '// m.h' > %t/m.h
+// RUN: echo '#include "m.h"' > %t/a.h
+// RUN: %clang_cc1 -emit-pch -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
+// RUN: echo '// m.x' > %t/m.h
+// RUN: touch -m -a -t 20290101 %t/m.h
+// RUN: not %clang_cc1 -fsyntax-only -I %t -include-pch %t/a.pch %s -fvalidate-ast-input-files-content 2> %t/stderr
+// RUN: FileCheck %s < %t/stderr
+//
+// CHECK: file '[[M_H:.*[/\\]m\.h]]' has been modified since the precompiled header '[[A_PCH:.*/a\.pch]]' was built: content changed
+// CHECK: please rebuild precompiled header '[[A_PCH]]'
+// expected-no-diagnostics
Index: clang/test/Modules/validate-file-content.m
===
--- /dev/null
+++ clang/test/Modules/validate-file-content.m
@@ -0,0 +1,33 @@
+// REQUIRES: shell
+//
+// Check driver works
+// RUN: %clang -fmodules -fsyntax-only -fmodules-validate-input-files-content %s -### 2>&1 | FileCheck --check-prefix=CHECK-CC1 %s
+// CHECK-CC1: -fvalidate-ast-input-files-content
+//
+// PCH+Modules: Test that a mtime mismatch without content change is fine
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo '// m.h' > %t/m.h
+// RUN: echo '#include "m.h"' > %t/a.h
+// RUN: echo 'module m { header "m.h" }' > %t/module.modulemap
+// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
+// RUN: touch -m -a -t 20290101 %t/m.h
+// RUN: %clang_cc1 -fsyntax-only -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t -include-pch %t/a.pch %s -verify -fvalidate-ast-input-files-content
+//
+// PCH+Modules: Test that a mtime mismatch with content change
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: echo '// m.h' > %t/m.h
+// RUN: echo '#include "m.h"' > %t/a.h
+// RUN: echo 'module m { header "m.h" }' > %t/module.modulemap
+// RUN: %clang_cc1 -emit-pch -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -o %t/a.pch -I %t -x objective-c-header %t/a.h -fvalidate-ast-input-files-content
+// RUN: echo '// m.x' > %t/m.h
+// RUN: touch -m -a -t 20290101 %t/m.h
+// RUN: not %clang_cc1 -fsyntax-only -fmodules-cache-path=%t/cache -fmodules -fimplicit-module-maps -I %t -include-pch %t/a.pch %s -fvalidate-ast-input-files-content 2> %t/stderr
+// RUN: FileCheck %s < %t/stderr
+//
+// CHECK: file '[[M_H:.*[/\\]m\.h]]' has been modified since the precompiled header '[[A_PCH:.*/a\.pch]]' was built: content changed
+// CHECK: '[[M_H]]' required by '[[M_PCM:.*[/\\]m.*\.pcm]]'
+// CHECK: '[[M_PCM]]' required by '[[A_PCH]]'
+// CHECK: please rebuild precompiled header '[[A_PCH]]'
+// expected-no-diagnostics
Index: clang/lib/Serialization/ASTWriter.cpp
===
--- clang/lib/Serialization/ASTWriter.cpp
+++ clang/lib/Serialization/ASTWriter.cpp
@@ -1099,6 +1099,7 @@
 
   BLOCK(INPUT_FILES_BLOCK);
   RECORD(INPUT_FILE);
+  RECORD(INPUT_FILE_HASH);
 
   // AST Top-Level Block.
   BLOCK(AST_BLOCK);
@@ -1764,6 +1765,7 @@
   bool IsTransient;
   bool BufferOverridden;
   

[PATCH] D62686: [RISCV] Add support for save/restore of callee-saved registers via libcalls

2019-10-14 Thread Ana Pazos via Phabricator via cfe-commits
apazos added a comment.

Here is the bugpoint-reduced test case for the SPEC failure when enabling 
-msave-restore and allowing tail calls:

Run the command llc test.ll -mattr=+save-restore -o out.s

You will see the code generated is wrong:

  tail__riscv_restore_2
   jr  a5

target datalayout = "e-m:e-p:32:32-i64:64-n32-S128"
target triple = "riscv32-unknown-linux-gnu"

%struct.1_s = type { i8*, i8*, i8*}
%struct.2_s = type { i8*, i8*, i8*}

declare dso_local void @test2() local_unnamed_addr
declare dso_local i32 @test3(%struct.2_s* nonnull %a, %struct.1_s** %b) 
local_unnamed_addr

define dso_local void @test1(%struct.2_s* %a, %struct.1_s** %b) 
local_unnamed_addr  {
entry:

  br i1 undef, label %if.end2, label %if.then

if.then:  ; preds = %entry

  tail call void @test2()
  br label %if.end2

if.end2:  ; preds = %if.then, %entry

  %call3 = tail call i32 null(%struct.2_s* nonnull %a, %struct.1_s** %b)
  ret void

}

To summarize the issues we have detected so far:

1. Bug1: When transforming a tail call back into a regular call, the 
transformation is not correctly preserving the original call's return values.

I fixed this by conservatively adding RegState::Implicit definitions for each 
possible integer and FP return registers, when defining the riscv_restore tail 
call.

2. Bug2: test case provided above. Please Lewis take a look at how this case 
can be fixed.

3. I have also run the tests with "-fno-optimize-sibling-calls -msave-restore", 
i.e., disabling tail calls when m-save-restore is enabled.

With this config, issues (1) and (2) do not happen.
There is some loss in code size savings when using fno-optimize-sibling-calls.
But still we see code size savings benefit from -msave-restore.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62686



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


[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-14 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D67723#1708671 , @aprantl wrote:

> > Since that change, we treat line zero the same as "no location". If there 
> > are no locations in a basic block, then the whole block inherits the line 
> > number from the block layout predecessor, which could be unrelated. Keeping 
> > the inlined call site location gives us the highest likelihood that "step 
> > over" will stop at the next statement.
>
> Who is "we" in this context? The CodeView backend?
>  As far as DWARF is concerned (and LLVM mostly inherits the DWARF semantics) 
> line 0 is well-defined and means compiler-generated code or otherwise no 
> unambiguous source location. DWARF-based debuggers know to skip over 
> instructions with line 0.
>
> Is the problem that CodeView doesn't have this concept, or does the Windows 
> debugger no know how to deal with it (or both)?
>
> I'm feeling rather strongly that that LLVM should not be emitting wrong debug 
> info to work around bugs in a debugger. I understand that sometimes this 
> isn't possible because we don't control the consumers. The correct thing to 
> do here is to guard the workaround by a debugger tuning flag. For DWARF, we 
> do want line 0 here.


(+1 to all that, FWIW)

Though I think in this case since it's got to be handled during the 
transformation (rather than as an after the fact choice at debug-info-emission 
time) it might not be practical to guard by a debugger tuning flag. It 
could/should be guarded though, but may just have to be guarded by the format 
(not that we have any other debuggers consuming CodeView anyway, so I think 
it's sufficient here).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67723



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


r374840 - Add -fno-experimental-pass-manager to make clear which pass manager

2019-10-14 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Mon Oct 14 16:01:48 2019
New Revision: 374840

URL: http://llvm.org/viewvc/llvm-project?rev=374840=rev
Log:
Add -fno-experimental-pass-manager to make clear which pass manager
we're running and to make flipping the default not regress testing.

Modified:
cfe/trunk/test/Misc/loop-opt-setup.c

Modified: cfe/trunk/test/Misc/loop-opt-setup.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/loop-opt-setup.c?rev=374840=374839=374840=diff
==
--- cfe/trunk/test/Misc/loop-opt-setup.c (original)
+++ cfe/trunk/test/Misc/loop-opt-setup.c Mon Oct 14 16:01:48 2019
@@ -1,5 +1,5 @@
 // RUN: %clang -O1 -fexperimental-new-pass-manager -fno-unroll-loops -S -o - 
%s -emit-llvm | FileCheck %s
-// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+// RUN: %clang -O1 -fno-experimental-new-pass-manager -fno-unroll-loops -S -o 
- %s -emit-llvm | FileCheck %s
 extern int a[16];
 int b = 0;
 int foo(void) {


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


r374841 - [Modules][PCH] Hash input files content

2019-10-14 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Mon Oct 14 16:02:03 2019
New Revision: 374841

URL: http://llvm.org/viewvc/llvm-project?rev=374841=rev
Log:
[Modules][PCH] Hash input files content

Summary:
When files often get touched during builds, the mtime based validation
leads to different problems in implicit modules builds, even when the
content doesn't actually change:

- Modules only: module invalidation due to out of date files. Usually causing 
rebuild traffic.
- Modules + PCH: build failures because clang cannot rebuild a module if it 
comes from building a PCH.
- PCH: build failures because clang cannot rebuild a PCH in case one of the 
input headers has different mtime.

This patch proposes hashing the content of input files (headers and
module maps), which is performed during serialization time. When looking
at input files for validation, clang only computes the hash in case
there's a mtime mismatch.

I've tested a couple of different hash algorithms availble in LLVM in
face of building modules+pch for `#import `:
- `hash_code`: performace diff within the noise, total module cache increased 
by 0.07%.
- `SHA1`: 5% slowdown. Haven't done real size measurements, but it'd be 
BLOCK_ID+20 bytes per input file, instead of BLOCK_ID+8 bytes from `hash_code`.
- `MD5`: 3% slowdown. Like above, but BLOCK_ID+16 bytes per input file.

Given the numbers above, the patch uses `hash_code`. The patch also
improves invalidation error msgs to point out which type of problem the
user is facing: "mtime", "size" or "content".

rdar://problem/29320105

Reviewers: dexonsmith, arphaman, rsmith, aprantl

Subscribers: jkorous, cfe-commits, ributzka

Tags: #clang

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

Added:
cfe/trunk/test/Modules/validate-file-content.m
cfe/trunk/test/PCH/validate-file-content.m
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=374841=374840=374841=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td Mon Oct 14 
16:02:03 2019
@@ -18,13 +18,16 @@ def err_fe_pch_malformed : Error<
 def err_fe_pch_malformed_block : Error<
 "malformed block record in PCH file: '%0'">, DefaultFatal;
 def err_fe_pch_file_modified : Error<
-"file '%0' has been modified since the precompiled header '%1' was built">,
+"file '%0' has been modified since the precompiled header '%1' was built"
+": %select{size|mtime|content}2 changed">,
 DefaultFatal;
 def err_fe_module_file_modified : Error<
-"file '%0' has been modified since the module file '%1' was built">,
+"file '%0' has been modified since the module file '%1' was built"
+": %select{size|mtime|content}2 changed">,
 DefaultFatal;
 def err_fe_ast_file_modified : Error<
-"file '%0' has been modified since the AST file '%1' was built">,
+"file '%0' has been modified since the AST file '%1' was built"
+": %select{size|mtime|content}2 changed">,
 DefaultFatal;
 def err_fe_pch_file_overridden : Error<
 "file '%0' from the precompiled header has been overridden">;
@@ -399,6 +402,8 @@ def warn_module_uses_date_time : Warning
 def err_module_no_size_mtime_for_header : Error<
   "cannot emit module %0: %select{size|mtime}1 must be explicitly specified "
   "for missing header file \"%2\"">;
+def err_module_unable_to_hash_content : Error<
+  "failed to hash content for '%0' because memory buffer cannot be retrieved">;
 } // let CategoryName
 } // let Component
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=374841=374840=374841=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 14 16:02:03 2019
@@ -1368,6 +1368,28 @@ def fmodules_validate_system_headers : F
   HelpText<"Validate the system headers that a module depends on when loading 
the module">;
 def fno_modules_validate_system_headers : Flag<["-"], 
"fno-modules-validate-system-headers">,
   Group, Flags<[DriverOption]>;
+
+def fvalidate_ast_input_files_content:
+  Flag <["-"], "fvalidate-ast-input-files-content">,
+  Group, 

[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-14 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added a comment.

> Since that change, we treat line zero the same as "no location". If there are 
> no locations in a basic block, then the whole block inherits the line number 
> from the block layout predecessor, which could be unrelated. Keeping the 
> inlined call site location gives us the highest likelihood that "step over" 
> will stop at the next statement.

Who is "we" in this context? The CodeView backend?
As far as DWARF is concerned (and LLVM mostly inherits the DWARF semantics) 
line 0 is well-defined and means compiler-generated code or otherwise no 
unambiguous source location. DWARF-based debuggers know to skip over 
instructions with line 0.

Is the problem that CodeView doesn't have this concept, or does the Windows 
debugger no know how to deal with it (or both)?

I'm feeling rather strongly that that LLVM should not be emitting wrong debug 
info to work around bugs in a debugger. I understand that sometimes this isn't 
possible because we don't control the consumers. The correct thing to do here 
is to guard the workaround by a debugger tuning flag. For DWARF, we do want 
line 0 here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67723



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


Re: [PATCH] D68535: Fix loop unrolling initialization in the new pass manager

2019-10-14 Thread Eric Christopher via cfe-commits
Thanks for the text - I didn't have anything to add or change so I
just used it verbatim :)

Committed thusly:

Committed revision 374838.
Committed f64329154c3 to svn.

On Mon, Oct 7, 2019 at 9:36 AM Alina Sbirlea via Phabricator
 wrote:
>
> asbirlea added a comment.
>
> Maybe elaborate in the patch description what `determine when and how we will 
> unroll loops.` means?
> e.g.:
> "The default before and after this patch is for LoopUnroll to be enabled, and 
> for it to use a cost model to determine whether to unroll the loop 
> (`OnlyWhenForced = false`). Before this patch, disabling loop unroll would 
> not run the LoopUnroll pass. After this patch, the LoopUnroll pass is being 
> run, but it restricts unrolling to only the loops marked by a pragma 
> (`OnlyWhenForced = true`).
> In addition, this patch disables the UnrollAndJam pass when disabling 
> unrolling."
>
> Otherwise LGTM.
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D68535/new/
>
> https://reviews.llvm.org/D68535
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r374837 - [clang] add requirements to -Wa,-W test cases.

2019-10-14 Thread Nico Weber via cfe-commits
Hm, this means the test can't run on non-linux, so if someone breaks it on
e.g. win they won't see the failure. Maybe add a
--target=i386-unknown-linux instead? Then it might pass on all platforms.

On Mon, Oct 14, 2019 at 6:48 PM Jian Cai via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jcai19
> Date: Mon Oct 14 15:51:12 2019
> New Revision: 374837
>
> URL: http://llvm.org/viewvc/llvm-project?rev=374837=rev
> Log:
> [clang] add requirements to -Wa,-W test cases.
>
> Include linux as a test requirement.
>
> Modified:
> cfe/trunk/test/Driver/as-w-option.c
>
> Modified: cfe/trunk/test/Driver/as-w-option.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374837=374836=374837=diff
>
> ==
> --- cfe/trunk/test/Driver/as-w-option.c (original)
> +++ cfe/trunk/test/Driver/as-w-option.c Mon Oct 14 15:51:12 2019
> @@ -5,6 +5,9 @@
>  // RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1
> | FileCheck --check-prefix=CHECK-AS-FATAL %s
>  // RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings
> 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
>
> +// REQUIRES: clang-driver
> +// REQUIRES: linux
> +
>  // CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
>  // CHECK-NOIAS: "-W"
>  // CHECK-AS-NOWARN-NOT: warning:
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374838 - In the new pass manager use PTO.LoopUnrolling to determine when and how

2019-10-14 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Mon Oct 14 15:56:07 2019
New Revision: 374838

URL: http://llvm.org/viewvc/llvm-project?rev=374838=rev
Log:
In the new pass manager use PTO.LoopUnrolling to determine when and how
we will unroll loops. Also comment a few occasions where we need to
know whether or not we're forcing the unwinder or not.

The default before and after this patch is for LoopUnroll to be enabled,
and for it to use a cost model to determine whether to unroll the loop
(`OnlyWhenForced = false`). Before this patch, disabling loop unroll
would not run the LoopUnroll pass. After this patch, the LoopUnroll pass
is being run, but it restricts unrolling to only the loops marked by a
pragma (`OnlyWhenForced = true`).

In addition, this patch disables the UnrollAndJam pass when disabling unrolling.

Testcase is in clang because it's controlling how the loop optimizer
is being set up and there's no other way to trigger the behavior.

Added:
cfe/trunk/test/Misc/loop-opt-setup.c

Added: cfe/trunk/test/Misc/loop-opt-setup.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/loop-opt-setup.c?rev=374838=auto
==
--- cfe/trunk/test/Misc/loop-opt-setup.c (added)
+++ cfe/trunk/test/Misc/loop-opt-setup.c Mon Oct 14 15:56:07 2019
@@ -0,0 +1,12 @@
+// RUN: %clang -O1 -fexperimental-new-pass-manager -fno-unroll-loops -S -o - 
%s -emit-llvm | FileCheck %s
+// RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s
+extern int a[16];
+int b = 0;
+int foo(void) {
+#pragma unroll
+  for (int i = 0; i < 16; ++i)
+a[i] = b += 2;
+  return b;
+}
+// CHECK-NOT: br i1
+


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


r374837 - [clang] add requirements to -Wa,-W test cases.

2019-10-14 Thread Jian Cai via cfe-commits
Author: jcai19
Date: Mon Oct 14 15:51:12 2019
New Revision: 374837

URL: http://llvm.org/viewvc/llvm-project?rev=374837=rev
Log:
[clang] add requirements to -Wa,-W test cases.

Include linux as a test requirement.

Modified:
cfe/trunk/test/Driver/as-w-option.c

Modified: cfe/trunk/test/Driver/as-w-option.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374837=374836=374837=diff
==
--- cfe/trunk/test/Driver/as-w-option.c (original)
+++ cfe/trunk/test/Driver/as-w-option.c Mon Oct 14 15:51:12 2019
@@ -5,6 +5,9 @@
 // RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | 
FileCheck --check-prefix=CHECK-AS-FATAL %s
 // RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 
| FileCheck --check-prefix=CHECK-AS-FATAL %s
 
+// REQUIRES: clang-driver
+// REQUIRES: linux
+
 // CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
 // CHECK-NOIAS: "-W"
 // CHECK-AS-NOWARN-NOT: warning:


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


[PATCH] D68882: [test] Fix test failure

2019-10-14 Thread Eli Friedman via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4498d41932c6: [test] Fix test failure (authored by efriedma).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68882

Files:
  clang/test/CodeGen/asan-new-pm.ll


Index: clang/test/CodeGen/asan-new-pm.ll
===
--- clang/test/CodeGen/asan-new-pm.ll
+++ clang/test/CodeGen/asan-new-pm.ll
@@ -1,12 +1,10 @@
 ; Test that ASan runs with the new pass manager
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-
-target triple = "x86_64-unknown-unknown"
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s 
--check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s 
--check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s 
--check-prefixes=CHECK,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s 
--check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s 
--check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s 
--check-prefixes=CHECK,THINLTO
 
 ; DAG-CHECK: @llvm.global_ctors = {{.*}}@asan.module_ctor
 


Index: clang/test/CodeGen/asan-new-pm.ll
===
--- clang/test/CodeGen/asan-new-pm.ll
+++ clang/test/CodeGen/asan-new-pm.ll
@@ -1,12 +1,10 @@
 ; Test that ASan runs with the new pass manager
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-
-target triple = "x86_64-unknown-unknown"
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
 
 ; DAG-CHECK: @llvm.global_ctors = {{.*}}@asan.module_ctor
 
___

[PATCH] D41284: [Concepts] Associated constraints infrastructure.

2019-10-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/include/clang/Sema/Sema.h:5950
+  /// associated constraints of an older declaration of which it is a
+  /// redeclaration
+  bool CheckRedeclarationConstraintMatch(TemplateParameterList *Old,

Missing period.



Comment at: clang/test/CXX/concepts-ts/temp/concept/p4.cpp:1
+// RUN:  %clang_cc1 -std=c++2a -fconcepts-ts -verify %s
+

Please move this test and the others to the relevant place under 
`test/CXX/temp` rather than `test/CXX/concepts-ts` and remove `-fconcepts-ts` 
from the `RUN:` lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D41284



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


r374836 - [test] Fix test failure

2019-10-14 Thread Eli Friedman via cfe-commits
Author: efriedma
Date: Mon Oct 14 15:44:42 2019
New Revision: 374836

URL: http://llvm.org/viewvc/llvm-project?rev=374836=rev
Log:
[test] Fix test failure

The version mismatch symbol is version 9 on 32 bit android. Since
this test isn't actually testing any android specific functionality,
we force the target triple to x86_64-unknown-unknown in order to have
a consistent version number. It seems the test was already trying to
do this, just not doing it right

Patch by Christopher Tetrault

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


Modified:
cfe/trunk/test/CodeGen/asan-new-pm.ll

Modified: cfe/trunk/test/CodeGen/asan-new-pm.ll
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asan-new-pm.ll?rev=374836=374835=374836=diff
==
--- cfe/trunk/test/CodeGen/asan-new-pm.ll (original)
+++ cfe/trunk/test/CodeGen/asan-new-pm.ll Mon Oct 14 15:44:42 2019
@@ -1,12 +1,10 @@
 ; Test that ASan runs with the new pass manager
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -fexperimental-new-pass-manager 
-fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address %s | FileCheck %s --check-prefixes=CHECK,LTO,THINLTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address -flto %s | FileCheck %s --check-prefixes=CHECK,LTO
-; RUN: %clang_cc1 -S -emit-llvm -o - -O1 -fexperimental-new-pass-manager 
-fsanitize=address -flto=thin %s | FileCheck %s --check-prefixes=CHECK,THINLTO
-
-target triple = "x86_64-unknown-unknown"
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s 
--check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s 
--check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - 
-fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s 
--check-prefixes=CHECK,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address %s | FileCheck %s 
--check-prefixes=CHECK,LTO,THINLTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address -flto %s | FileCheck %s 
--check-prefixes=CHECK,LTO
+; RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -emit-llvm -o - -O1 
-fexperimental-new-pass-manager -fsanitize=address -flto=thin %s | FileCheck %s 
--check-prefixes=CHECK,THINLTO
 
 ; DAG-CHECK: @llvm.global_ctors = {{.*}}@asan.module_ctor
 


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


[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1428
+if (isa(BI)) {
+  BI = --(BI->eraseFromParent());
+  continue;

Will this work if the dbg.value is the first instruction of a basic block? I'd 
expect eraseFromParent to return a new iterator pointing to FI->begin(), then 
operator-- to back up to "before begin", which would probably crash or assert. 
This would make a good test case and shouldn't be too hard. You can try 
inlining `foo` in this example:
```
void bar();
int foo(bool cond, int x) {
  if (cond) {
x = 42; // should set up a dbg.value at BB start
bar(); // block select formation
  }
  return x;
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67723



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


Re: r374834 - Add support to -Wa,-W in clang

2019-10-14 Thread Nico Weber via cfe-commits
This fails on both win and mac:

http://45.33.8.238/mac/1678/step_6.txt
http://45.33.8.238/win/485/step_6.txt

On Mon, Oct 14, 2019 at 6:25 PM Jian Cai via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: jcai19
> Date: Mon Oct 14 15:28:03 2019
> New Revision: 374834
>
> URL: http://llvm.org/viewvc/llvm-project?rev=374834=rev
> Log:
> Add support to -Wa,-W in clang
>
> Summary:
> Currently clang does not support -Wa,-W, which suppresses warning
> messages in GNU assembler. Add this option for gcc compatibility.
> https://bugs.llvm.org/show_bug.cgi?id=43651. Reland with differential
> information.
>
> Reviewers: bcain
>
> Reviewed By: bcain
>
> Subscribers: george.burgess.iv, gbiv, llozano, manojgupta,
> nickdesaulniers, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D68884
>
> Added:
> cfe/trunk/test/Driver/as-w-option.c
> Modified:
> cfe/trunk/lib/Driver/ToolChains/Clang.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374834=374833=374834=diff
>
> ==
> --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Oct 14 15:28:03 2019
> @@ -2140,7 +2140,7 @@ static void CollectArgsForIntegratedAsse
>  CmdArgs.push_back("-msave-temp-labels");
>} else if (Value == "--fatal-warnings") {
>  CmdArgs.push_back("-massembler-fatal-warnings");
> -  } else if (Value == "--no-warn") {
> +  } else if (Value == "--no-warn" || Value == "-W") {
>  CmdArgs.push_back("-massembler-no-warn");
>} else if (Value == "--noexecstack") {
>  UseNoExecStack = true;
>
> Added: cfe/trunk/test/Driver/as-w-option.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374834=auto
>
> ==
> --- cfe/trunk/test/Driver/as-w-option.c (added)
> +++ cfe/trunk/test/Driver/as-w-option.c Mon Oct 14 15:28:03 2019
> @@ -0,0 +1,14 @@
> +// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 |
> FileCheck -check-prefix=CHECK-NOIAS %s
> +// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck
> -check-prefix=CHECK-IAS %s
> +// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck
> -allow-empty --check-prefix=CHECK-AS-NOWARN %s
> +// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck
> -allow-empty --check-prefix=CHECK-AS-NOWARN %s
> +// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1
> | FileCheck --check-prefix=CHECK-AS-FATAL %s
> +// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings
> 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
> +
> +// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
> +// CHECK-NOIAS: "-W"
> +// CHECK-AS-NOWARN-NOT: warning:
> +// CHECK-AS-FATAL-NOT: warning:
> +// CHECK-AS-FATAL: error
> +
> +__asm(".warning");
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68884: Add support to -Wa,-W in clang

2019-10-14 Thread Jian Cai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4ec5205da701: Add support to -Wa,-W in clang (authored by 
jcai19).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68884

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/as-w-option.c


Index: clang/test/Driver/as-w-option.c
===
--- /dev/null
+++ clang/test/Driver/as-w-option.c
@@ -0,0 +1,14 @@
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-IAS %s
+// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | 
FileCheck --check-prefix=CHECK-AS-FATAL %s
+// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 
| FileCheck --check-prefix=CHECK-AS-FATAL %s
+
+// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
+// CHECK-NOIAS: "-W"
+// CHECK-AS-NOWARN-NOT: warning:
+// CHECK-AS-FATAL-NOT: warning:
+// CHECK-AS-FATAL: error
+
+__asm(".warning");
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2140,7 +2140,7 @@
 CmdArgs.push_back("-msave-temp-labels");
   } else if (Value == "--fatal-warnings") {
 CmdArgs.push_back("-massembler-fatal-warnings");
-  } else if (Value == "--no-warn") {
+  } else if (Value == "--no-warn" || Value == "-W") {
 CmdArgs.push_back("-massembler-no-warn");
   } else if (Value == "--noexecstack") {
 UseNoExecStack = true;


Index: clang/test/Driver/as-w-option.c
===
--- /dev/null
+++ clang/test/Driver/as-w-option.c
@@ -0,0 +1,14 @@
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck -check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck -check-prefix=CHECK-IAS %s
+// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck -allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck -allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
+// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
+
+// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
+// CHECK-NOIAS: "-W"
+// CHECK-AS-NOWARN-NOT: warning:
+// CHECK-AS-FATAL-NOT: warning:
+// CHECK-AS-FATAL: error
+
+__asm(".warning");
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2140,7 +2140,7 @@
 CmdArgs.push_back("-msave-temp-labels");
   } else if (Value == "--fatal-warnings") {
 CmdArgs.push_back("-massembler-fatal-warnings");
-  } else if (Value == "--no-warn") {
+  } else if (Value == "--no-warn" || Value == "-W") {
 CmdArgs.push_back("-massembler-no-warn");
   } else if (Value == "--noexecstack") {
 UseNoExecStack = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D41217: [Concepts] Concept Specialization Expressions

2019-10-14 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Only minor comments, let me know if you'd like me to take another look after 
addressing these, or just go ahead and commit. Thanks!




Comment at: clang/lib/AST/ExprCXX.cpp:1676-1677
+ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo 
*ArgsAsWritten,
+ArrayRef ConvertedArgs, bool IsSatisfied,
+bool IsValueDependent)
+: Expr(ConceptSpecializationExprClass, C.BoolTy, VK_RValue, OK_Ordinary,

Consider passing `IsSatisfied` and `IsValueDependent` as a single 
`Optional` (with `None` meaning value-dependent).



Comment at: clang/lib/AST/ExprCXX.cpp:1719-1720
+ ->containsUnexpandedParameterPacks());
+  setInstantiationDependent(IsInstantiationDependent);
+  setContainsUnexpandedParameterPack(ContainsUnexpandedParameterPack);
+}

Please add

```
assert((!isValueDependent() || isInstantiationDependent()) && "should not be 
value-dependent");
```

or similar. If we marked the expression as being value-dependent but it's not 
instantiation-dependent, things would go badly wrong later (we wouldn't 
substitute into it during instantiation, for example).



Comment at: clang/lib/Sema/SemaConcept.cpp:39
+
+  QualType Type = ConstraintExpression->getType().getNonReferenceType()
+  .getUnqualifiedType();

No need for `getNonReferenceType()` here; expressions never have reference type.



Comment at: clang/lib/Sema/SemaConcept.cpp:40-41
+  QualType Type = ConstraintExpression->getType().getNonReferenceType()
+  .getUnqualifiedType();
+  if (!Context.hasSameType(Type, Context.BoolTy)) {
+Diag(ConstraintExpression->getExprLoc(),

I think it'd be a bit better to remove the `getUnqualifiedType()` call and use 
`hasSameUnqualifiedType` instead. That way the diagnostic below will preserve 
the cv-qualifications (along with any type sugar that you would need to remove 
to remove the qualifiers).



Comment at: clang/lib/Serialization/ASTReaderStmt.cpp:737
 
+void ASTStmtReader::VisitConceptSpecializationExpr(
+ConceptSpecializationExpr *E) {

Please can you add some basic test coverage for the serialization code?



Comment at: clang/test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp:1
-// RUN:  %clang_cc1 -std=c++2a -fconcepts-ts -verify %s
+// RUN:  %clang_cc1 -std=c++2a -fconcepts-ts -verify -triple x86_64-linux-gnu 
%s
 

Can we remove `-fconcepts-ts` from the `RUN` line?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D41217



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


[PATCH] D68720: Support -fstack-clash-protection for x86

2019-10-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

For maintenance reasons, I'd really prefer it if we could find a way to reuse 
the existing code that calls an external stack probe function. What do you 
think about taking a look at X86RetpolineThunks.cpp and doing something similar 
to that? Basically, when the user sets `-fstack-clash-protection`, LLVM will 
emit a small comdat+weak function into every object file that has the same ABI 
as the existing stack probe mechanism. For other prior art, you can also look 
at how `__clang_call_terminate` works.




Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:400
+!(STI.isOSWindows() && !STI.isTargetMachO());
+if (InlineStackClashProtector && !InEpilogue) {
+  const uint64_t PageSize = TLI.getStackProbeSize(MF);

serge-sans-paille wrote:
> efriedma wrote:
> > Why is this code in a different location from the stack probing code that 
> > generates a call?
> Because `BuildStackAdjustment` has more callsites than just emitPrologue and 
> we want to capture all stack manipulation.
If you care about those cases, we should have tests for all of them. These are 
all the cases:
1. TailCallReturnAddrDelta: When doing guaranteed TCO for a callee with >4K of 
argument memory
2. eliminateCallFramePseudoInstr: When doing stack adjustments to set up a call 
with more than 4K of arguments

Both of these cases involve setting up arguments to calls, and I think we can 
guarantee that the compiler will emit writes to every argument stack slot. So, 
to set up one of these cases, we'd have this code:
```
struct EightK { int a[2048]; };
void passEightK(EightK);
void foo() {
  EightK x;
  memset(, 0, sizeof(x));
  passEightK(x); // some targets will pass indirect, 32-bit probably uses byval.
}
```

In this case, LLVM happens to use rep;movsl to copy the argument memory. It 
could use memcpy, but either way, it will probe all those bytes.

I think that means it's safe to move to emitSPUpdate. I would greatly prefer 
that `BuildStackAdjustment` remain a simple primitive that generates a single 
instruction.



Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:353
 
+static const DenseMap OpcodeToSPOperandIndex = {
+{X86::MOV8mi, 3}, {X86::MOV16mi, 3}, {X86::MOV32mi, 3}, {X86::MOV64mi32, 
3},

Please no dynamically initialized globals. The LLVM-y thing would be to use a 
switch.



Comment at: llvm/test/CodeGen/X86/stack-clash-dynamic-alloca.ll:9-11
+; CHECK: subq   $4096, %rsp
+; CHECK: movq   $0, (%rsp)
+  %a = alloca i32, i32 %n, align 16

This seems like a good use case for update_llc_test_checks.py. I'd want to see 
the body of the loop, the cmp, the jl, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68720



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


r374834 - Add support to -Wa,-W in clang

2019-10-14 Thread Jian Cai via cfe-commits
Author: jcai19
Date: Mon Oct 14 15:28:03 2019
New Revision: 374834

URL: http://llvm.org/viewvc/llvm-project?rev=374834=rev
Log:
Add support to -Wa,-W in clang

Summary:
Currently clang does not support -Wa,-W, which suppresses warning
messages in GNU assembler. Add this option for gcc compatibility.
https://bugs.llvm.org/show_bug.cgi?id=43651. Reland with differential
information.

Reviewers: bcain

Reviewed By: bcain

Subscribers: george.burgess.iv, gbiv, llozano, manojgupta, nickdesaulniers, 
cfe-commits

Tags: #clang

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

Added:
cfe/trunk/test/Driver/as-w-option.c
Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374834=374833=374834=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Oct 14 15:28:03 2019
@@ -2140,7 +2140,7 @@ static void CollectArgsForIntegratedAsse
 CmdArgs.push_back("-msave-temp-labels");
   } else if (Value == "--fatal-warnings") {
 CmdArgs.push_back("-massembler-fatal-warnings");
-  } else if (Value == "--no-warn") {
+  } else if (Value == "--no-warn" || Value == "-W") {
 CmdArgs.push_back("-massembler-no-warn");
   } else if (Value == "--noexecstack") {
 UseNoExecStack = true;

Added: cfe/trunk/test/Driver/as-w-option.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374834=auto
==
--- cfe/trunk/test/Driver/as-w-option.c (added)
+++ cfe/trunk/test/Driver/as-w-option.c Mon Oct 14 15:28:03 2019
@@ -0,0 +1,14 @@
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-IAS %s
+// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | 
FileCheck --check-prefix=CHECK-AS-FATAL %s
+// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 
| FileCheck --check-prefix=CHECK-AS-FATAL %s
+
+// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
+// CHECK-NOIAS: "-W"
+// CHECK-AS-NOWARN-NOT: warning:
+// CHECK-AS-FATAL-NOT: warning:
+// CHECK-AS-FATAL: error
+
+__asm(".warning");


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


r374833 - Revert "Add support to -Wa,-W in clang"

2019-10-14 Thread Jian Cai via cfe-commits
Author: jcai19
Date: Mon Oct 14 15:28:01 2019
New Revision: 374833

URL: http://llvm.org/viewvc/llvm-project?rev=374833=rev
Log:
Revert "Add support to -Wa,-W in clang"

This reverts commit e72eeca43b9577be2aae55f7603febbf223a6ab3.

Removed:
cfe/trunk/test/Driver/as-w-option.c
Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374833=374832=374833=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Oct 14 15:28:01 2019
@@ -2140,7 +2140,7 @@ static void CollectArgsForIntegratedAsse
 CmdArgs.push_back("-msave-temp-labels");
   } else if (Value == "--fatal-warnings") {
 CmdArgs.push_back("-massembler-fatal-warnings");
-  } else if (Value == "--no-warn" || Value == "-W") {
+  } else if (Value == "--no-warn") {
 CmdArgs.push_back("-massembler-no-warn");
   } else if (Value == "--noexecstack") {
 UseNoExecStack = true;

Removed: cfe/trunk/test/Driver/as-w-option.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374832=auto
==
--- cfe/trunk/test/Driver/as-w-option.c (original)
+++ cfe/trunk/test/Driver/as-w-option.c (removed)
@@ -1,14 +0,0 @@
-// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-NOIAS %s
-// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-IAS %s
-// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
-// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
-// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | 
FileCheck --check-prefix=CHECK-AS-FATAL %s
-// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 
| FileCheck --check-prefix=CHECK-AS-FATAL %s
-
-// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
-// CHECK-NOIAS: "-W"
-// CHECK-AS-NOWARN-NOT: warning:
-// CHECK-AS-FATAL-NOT: warning:
-// CHECK-AS-FATAL: error
-
-__asm(".warning");


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


[PATCH] D61675: [WIP] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator

2019-10-14 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added a comment.

Both the ASan build:

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

and the OCaml build:

  http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/19255 

have completed successfully with the latest patches. Will continue to monitor 
the bots for further problems.

I apologize again for the noise...

@pcc @gribozavr


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61675



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


[PATCH] D68896: PR43080: Do not build context-sensitive expressions during name classification.

2019-10-14 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7e8fe67f0e26: PR43080: Do not build context-sensitive 
expressions during name classification. (authored by Richard Smith 
richard-l...@metafoo.co.uk).

Changed prior to commit:
  https://reviews.llvm.org/D68896?vs=224765=224910#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68896

Files:
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Parse/ParseExprCXX.cpp
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Parse/ParseTentative.cpp
  clang/lib/Parse/Parser.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/test/CodeGenCXX/odr-use-lookahead.cpp
  clang/test/SemaCXX/lambda-invalid-capture.cpp

Index: clang/test/SemaCXX/lambda-invalid-capture.cpp
===
--- clang/test/SemaCXX/lambda-invalid-capture.cpp
+++ clang/test/SemaCXX/lambda-invalid-capture.cpp
@@ -16,3 +16,10 @@
   auto q = [child]{};
   const int n = sizeof(q);
 }
+
+int pr43080(int i) { // expected-note {{declared here}}
+  return [] { // expected-note {{begins here}}
+return sizeof i <
+  i; // expected-error {{variable 'i' cannot be implicitly captured in a lambda with no capture-default specified}}
+  }();
+}
Index: clang/test/CodeGenCXX/odr-use-lookahead.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/odr-use-lookahead.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -emit-llvm-only %s
+
+namespace PR43080 {
+  int f(int i) { return sizeof igetName());
 if (Index.first) {
-  InsertOCLBuiltinDeclarationsFromTable(S, R, II, Index.first - 1,
+  InsertOCLBuiltinDeclarationsFromTable(*this, R, II, Index.first - 1,
 Index.second);
   return true;
 }
@@ -860,14 +860,14 @@
   if (unsigned BuiltinID = II->getBuiltinID()) {
 // In C++ and OpenCL (spec v1.2 s6.9.f), we don't have any predefined
 // library functions like 'malloc'. Instead, we'll just error.
-if ((S.getLangOpts().CPlusPlus || S.getLangOpts().OpenCL) &&
-S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
+if ((getLangOpts().CPlusPlus || getLangOpts().OpenCL) &&
+Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
   return false;
 
-if (NamedDecl *D = S.LazilyCreateBuiltin((IdentifierInfo *)II,
- BuiltinID, S.TUScope,
- R.isForRedeclaration(),
- R.getNameLoc())) {
+if (NamedDecl *D = LazilyCreateBuiltin((IdentifierInfo *)II,
+   BuiltinID, TUScope,
+   R.isForRedeclaration(),
+   R.getNameLoc())) {
   R.addDecl(D);
   return true;
 }
@@ -1013,7 +1013,7 @@
 }
   }
 
-  if (!Found && DC->isTranslationUnit() && LookupBuiltin(S, R))
+  if (!Found && DC->isTranslationUnit() && S.LookupBuiltin(R))
 return true;
 
   if (R.getLookupName().getNameKind()
@@ -2011,7 +2011,7 @@
   // If we didn't find a use of this identifier, and if the identifier
   // corresponds to a compiler builtin, create the decl object for the builtin
   // now, injecting it into translation unit scope, and return it.
-  if (AllowBuiltinCreation && LookupBuiltin(*this, R))
+  if (AllowBuiltinCreation && LookupBuiltin(R))
 return true;
 
   // If we didn't find a use of this identifier, the ExternalSource
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -2482,23 +2482,20 @@
   return BuildDeclarationNameExpr(SS, R, /* ADL */ false);
 }
 
-/// LookupInObjCMethod - The parser has read a name in, and Sema has
-/// detected that we're currently inside an ObjC method.  Perform some
-/// additional lookup.
+/// The parser has read a name in, and Sema has detected that we're currently
+/// inside an ObjC method. Perform some additional checks and determine if we
+/// should form a reference to an ivar.
 ///
 /// Ideally, most of this would be done by lookup, but there's
 /// actually quite a lot of extra work involved.
-///
-/// Returns a null sentinel to indicate trivial success.
-ExprResult
-Sema::LookupInObjCMethod(LookupResult , Scope *S,
- IdentifierInfo *II, bool AllowBuiltinCreation) {
+DeclResult Sema::LookupIvarInObjCMethod(LookupResult , Scope *S,
+IdentifierInfo *II) {
 

[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-14 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 224909.
akhuang added a comment.

- Fixes for DbgInfoIntrinsic type and change test cmd

Reverted the line 0 change - I wasn't sure if it would be an issue since
the debugger doesn't step through those lines.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67723

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-no-inline-line-tables.c
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/Attributes.td
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Transforms/Inline/no-inline-line-tables.ll

Index: llvm/test/Transforms/Inline/no-inline-line-tables.ll
===
--- /dev/null
+++ llvm/test/Transforms/Inline/no-inline-line-tables.ll
@@ -0,0 +1,64 @@
+; RUN: opt < %s -inline -S | FileCheck %s
+
+; This tests that functions with the attribute `no-inline-line-tables` have the
+; correct debug information when they are inlined.
+
+; ModuleID = 't.c'
+source_filename = "t.c"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-windows-msvc"
+
+; Function Attrs: alwaysinline nounwind
+define dso_local i32 @f(i32 %i) #0 !dbg !7 {
+entry:
+  %i.addr = alloca i32, align 4
+  store i32 %i, i32* %i.addr, align 4
+  call void @llvm.dbg.declare(metadata i32* %i.addr, metadata !12, metadata !DIExpression()), !dbg !13
+  %0 = load i32, i32* %i.addr, align 4, !dbg !14
+  ret i32 %0, !dbg !14
+}
+
+; Function Attrs: nounwind readnone speculatable willreturn
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+
+; Check that debug info for inlined code uses the call location and that debug
+; intrinsics are removed.
+; Function Attrs: noinline nounwind optnone
+define dso_local i32 @main() #2 !dbg !15 {
+entry:
+; CHECK-LABEL: @main()
+; CHECK-NOT: @f
+; CHECK-NOT: @llvm.dbg.declare
+; CHECK: %{{[0-9]+}} = load i32, i32* %i.addr.i, align 4, !dbg ![[VAR:[0-9]+]]
+; CHECK: ![[VAR]] = !DILocation(line: 5, scope: !{{[0-9]+}})
+  %call = call i32 @f(i32 23), !dbg !18
+  ret i32 0, !dbg !19
+}
+
+attributes #0 = { alwaysinline nounwind "no-inline-line-tables" }
+attributes #2 = { noinline nounwind optnone "no-inline-line-tables"}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5}
+!llvm.ident = !{!6}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git cb37bd6bbb4ca4b23838b08412d976bdab07e4fe)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: "", directory: "/usr/local/google/home/akhuang/testing/inline-line-tables", checksumkind: CSK_MD5, checksum: "69f4cc67a00fe0c3f251a593209753fd")
+!2 = !{}
+!3 = !{i32 2, !"CodeView", i32 1}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 2}
+!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git cb37bd6bbb4ca4b23838b08412d976bdab07e4fe)"}
+!7 = distinct !DISubprogram(name: "f", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!8 = !DIFile(filename: "t.c", directory: "/usr/local/google/home/akhuang/testing/inline-line-tables", checksumkind: CSK_MD5, checksum: "69f4cc67a00fe0c3f251a593209753fd")
+!9 = !DISubroutineType(types: !10)
+!10 = !{!11, !11}
+!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!12 = !DILocalVariable(name: "i", arg: 1, scope: !7, file: !8, line: 1, type: !11)
+!13 = !DILocation(line: 1, scope: !7)
+!14 = !DILocation(line: 2, scope: !7)
+!15 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!16 = !DISubroutineType(types: !17)
+!17 = !{!11}
+!18 = !DILocation(line: 5, scope: !15)
+!19 = !DILocation(line: 6, scope: !15)
Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
===
--- llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1405,6 +1405,10 @@
   // other.
   DenseMap IANodes;
 
+  // Check if we are not generating inline line tables and want to use
+  // the call site location instead.
+  bool NoInlineLineTables = Fn->hasFnAttribute("no-inline-line-tables");
+
   for (; FI != Fn->end(); ++FI) {
 for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
  BI != BE; ++BI) {
@@ -1416,6 +1420,18 @@
 BI->setMetadata(LLVMContext::MD_loop, NewLoopID);
   }
 
+  // If we are not generating inline line tables, set the debug location
+  // of the inlined code 

r374826 - PR43080: Do not build context-sensitive expressions during name classification.

2019-10-14 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Oct 14 14:53:03 2019
New Revision: 374826

URL: http://llvm.org/viewvc/llvm-project?rev=374826=rev
Log:
PR43080: Do not build context-sensitive expressions during name classification.

Summary:
We don't know what context to use until the classification result is
consumed by the parser, which could happen in a different semantic
context. So don't build the expression that results from name
classification until we get to that point and can handle it properly.

This covers everything except C++ implicit class member access, which
is a little awkward to handle properly in the face of the protected
member access check. But it at least fixes all the currently-filed
instances of PR43080.

Reviewers: efriedma

Subscribers: cfe-commits

Tags: #clang

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

Added:
cfe/trunk/test/CodeGenCXX/odr-use-lookahead.cpp
Modified:
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/test/SemaCXX/lambda-invalid-capture.cpp

Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=374826=374825=374826=diff
==
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Mon Oct 14 14:53:03 2019
@@ -728,6 +728,11 @@ ANNOTATION(typename) // annotation f
 ANNOTATION(template_id)  // annotation for a C++ template-id that names a
  // function template specialization (not a type),
  // e.g., "std::swap"
+ANNOTATION(non_type) // annotation for a single non-type declaration
+ANNOTATION(non_type_undeclared) // annotation for an undeclared identifier that
+// was assumed to be an ADL-only function name
+ANNOTATION(non_type_dependent)  // annotation for an assumed non-type member of
+// a dependent base class
 ANNOTATION(primary_expr) // annotation for a primary expression
 ANNOTATION(decltype) // annotation for a decltype expression,
  // e.g., "decltype(foo.bar())"

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=374826=374825=374826=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Mon Oct 14 14:53:03 2019
@@ -766,6 +766,22 @@ private:
 Tok.setAnnotationValue(T.getAsOpaquePtr());
   }
 
+  static NamedDecl *getNonTypeAnnotation(const Token ) {
+return static_cast(Tok.getAnnotationValue());
+  }
+
+  static void setNonTypeAnnotation(Token , NamedDecl *ND) {
+Tok.setAnnotationValue(ND);
+  }
+
+  static IdentifierInfo *getIdentifierAnnotation(const Token ) {
+return static_cast(Tok.getAnnotationValue());
+  }
+
+  static void setIdentifierAnnotation(Token , IdentifierInfo *ND) {
+Tok.setAnnotationValue(ND);
+  }
+
   /// Read an already-translated primary expression out of an annotation
   /// token.
   static ExprResult getExprAnnotation(const Token ) {
@@ -799,8 +815,7 @@ private:
 /// Annotation was successful.
 ANK_Success
   };
-  AnnotatedNameKind TryAnnotateName(bool IsAddressOfOperand,
-CorrectionCandidateCallback *CCC = 
nullptr);
+  AnnotatedNameKind TryAnnotateName(CorrectionCandidateCallback *CCC = 
nullptr);
 
   /// Push a tok::annot_cxxscope token onto the token stream.
   void AnnotateScopeToken(CXXScopeSpec , bool IsNewAnnotation);

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=374826=374825=374826=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Oct 14 14:53:03 2019
@@ -1855,29 +1855,52 @@ public:
   /// Describes the result of the name lookup and resolution performed
   /// by \c ClassifyName().
   enum NameClassificationKind {
+/// This name is not a type or template in this context, but might be
+/// something else.
 NC_Unknown,
+/// Classification failed; an error has been produced.
 NC_Error,
+/// The name has been typo-corrected to a keyword.
 NC_Keyword,
+/// The name was classified as a type.
 NC_Type,
-NC_Expression,
-

[PATCH] D68884: Add support to -Wa,-W in clang

2019-10-14 Thread Jian Cai via Phabricator via cfe-commits
jcai19 updated this revision to Diff 224908.
jcai19 added a comment.

For autogenerated comment log.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68884

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/as-w-option.c


Index: clang/test/Driver/as-w-option.c
===
--- /dev/null
+++ clang/test/Driver/as-w-option.c
@@ -0,0 +1,14 @@
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-IAS %s
+// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | 
FileCheck --check-prefix=CHECK-AS-FATAL %s
+// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 
| FileCheck --check-prefix=CHECK-AS-FATAL %s
+
+// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
+// CHECK-NOIAS: "-W"
+// CHECK-AS-NOWARN-NOT: warning:
+// CHECK-AS-FATAL-NOT: warning:
+// CHECK-AS-FATAL: error
+
+__asm(".warning");
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2140,7 +2140,7 @@
 CmdArgs.push_back("-msave-temp-labels");
   } else if (Value == "--fatal-warnings") {
 CmdArgs.push_back("-massembler-fatal-warnings");
-  } else if (Value == "--no-warn") {
+  } else if (Value == "--no-warn" || Value == "-W") {
 CmdArgs.push_back("-massembler-no-warn");
   } else if (Value == "--noexecstack") {
 UseNoExecStack = true;


Index: clang/test/Driver/as-w-option.c
===
--- /dev/null
+++ clang/test/Driver/as-w-option.c
@@ -0,0 +1,14 @@
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck -check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck -check-prefix=CHECK-IAS %s
+// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck -allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck -allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
+// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck --check-prefix=CHECK-AS-FATAL %s
+
+// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
+// CHECK-NOIAS: "-W"
+// CHECK-AS-NOWARN-NOT: warning:
+// CHECK-AS-FATAL-NOT: warning:
+// CHECK-AS-FATAL: error
+
+__asm(".warning");
Index: clang/lib/Driver/ToolChains/Clang.cpp
===
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -2140,7 +2140,7 @@
 CmdArgs.push_back("-msave-temp-labels");
   } else if (Value == "--fatal-warnings") {
 CmdArgs.push_back("-massembler-fatal-warnings");
-  } else if (Value == "--no-warn") {
+  } else if (Value == "--no-warn" || Value == "-W") {
 CmdArgs.push_back("-massembler-no-warn");
   } else if (Value == "--noexecstack") {
 UseNoExecStack = true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r374822 - Add support to -Wa,-W in clang

2019-10-14 Thread Jian Cai via cfe-commits
Author: jcai19
Date: Mon Oct 14 14:21:39 2019
New Revision: 374822

URL: http://llvm.org/viewvc/llvm-project?rev=374822=rev
Log:
Add support to -Wa,-W in clang

Currently clang does not support -Wa,-W, which suppresses warning
messages in GNU assembler. Add this option for gcc compatibility.
https://bugs.llvm.org/show_bug.cgi?id=43651

Added:
cfe/trunk/test/Driver/as-w-option.c
Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374822=374821=374822=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Oct 14 14:21:39 2019
@@ -2140,7 +2140,7 @@ static void CollectArgsForIntegratedAsse
 CmdArgs.push_back("-msave-temp-labels");
   } else if (Value == "--fatal-warnings") {
 CmdArgs.push_back("-massembler-fatal-warnings");
-  } else if (Value == "--no-warn") {
+  } else if (Value == "--no-warn" || Value == "-W") {
 CmdArgs.push_back("-massembler-no-warn");
   } else if (Value == "--noexecstack") {
 UseNoExecStack = true;

Added: cfe/trunk/test/Driver/as-w-option.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/as-w-option.c?rev=374822=auto
==
--- cfe/trunk/test/Driver/as-w-option.c (added)
+++ cfe/trunk/test/Driver/as-w-option.c Mon Oct 14 14:21:39 2019
@@ -0,0 +1,14 @@
+// RUN: %clang -### %s -c -o tmp.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-NOIAS %s
+// RUN: %clang -### %s -c -o tmp.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-check-prefix=CHECK-IAS %s
+// RUN: %clang %s -c -o %t.o -integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: %clang %s -c -o %t.o -fno-integrated-as -Wa,-W 2>&1 | FileCheck 
-allow-empty --check-prefix=CHECK-AS-NOWARN %s
+// RUN: not %clang %s -c -o %t.o -integrated-as -Wa,--fatal-warnings 2>&1 | 
FileCheck --check-prefix=CHECK-AS-FATAL %s
+// RUN: not %clang %s -c -o %t.o -fno-integrated-as -Wa,--fatal-warnings 2>&1 
| FileCheck --check-prefix=CHECK-AS-FATAL %s
+
+// CHECK-IAS: "-cc1" {{.*}} "-massembler-no-warn"
+// CHECK-NOIAS: "-W"
+// CHECK-AS-NOWARN-NOT: warning:
+// CHECK-AS-FATAL-NOT: warning:
+// CHECK-AS-FATAL: error
+
+__asm(".warning");


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


[PATCH] D68953: Enable most VFS tests on Windows

2019-10-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added subscribers: arphaman, vsapsai, Bigcheese.
rnk added a comment.

+VFS people, mostly just to let them know
@arphaman @Bigcheese @vsapsai

Code changes all look good to me, but I had a bunch of questions.




Comment at: clang/lib/Lex/HeaderSearch.cpp:782-783
   // Concatenate the requested file onto the directory.
-  // FIXME: Portability.  Filename concatenation should be in sys::Path.
-  TmpDir = IncluderAndDir.second->getName();
-  TmpDir.push_back('/');
-  TmpDir.append(Filename.begin(), Filename.end());
+  TmpPath = IncluderAndDir.second->getName();
+  llvm::sys::path::append(TmpPath, Filename);
 

I'm surprised this just works. :) You ran the whole clang test suite, and 
nothing broke, right? I would've expected something to accidentally depend on 
this behavior.



Comment at: clang/test/VFS/external-names.c:4-5
 
 // FIXME: PR43272
 // XFAIL: system-windows
 

You made changes to this file, but it's still XFAILed. Is that intentional?



Comment at: llvm/lib/Support/VirtualFileSystem.cpp:1619-1620
 
   sys::path::const_iterator Start = sys::path::begin(Path);
   sys::path::const_iterator End = sys::path::end(Path);
   for (const auto  : Roots) {

After reading the code for a while, I see that drive letters are handled as 
just another component in the path, so I guess this code all works without 
explicitly considering drive letters.



Comment at: llvm/lib/Support/VirtualFileSystem.cpp:1839
   SmallVector Components;
-  Components.push_back("/");
+  Components.push_back(sys::path::get_separator());
   getVFSEntries(*RootE, Components, CollectedEntries);

I think this will ultimately produce paths that look like: `\C:\foo\bar\baz`. 
Ultimately, we loop over the components above and repeatedly call 
sys::path::append on them.

Clang only uses this function for collecting module dependency info, it seems. 
Maybe that's what the remaining failures are about?


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

https://reviews.llvm.org/D68953



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


r374821 - [NFC] Fix ClangScanDeps/static-analyzer.c test on Windows

2019-10-14 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Mon Oct 14 14:06:11 2019
New Revision: 374821

URL: http://llvm.org/viewvc/llvm-project?rev=374821=rev
Log:
[NFC] Fix ClangScanDeps/static-analyzer.c test on Windows

Follow-up to c5d14b5c6fa

Modified:
cfe/trunk/test/ClangScanDeps/static-analyzer.c

Modified: cfe/trunk/test/ClangScanDeps/static-analyzer.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ClangScanDeps/static-analyzer.c?rev=374821=374820=374821=diff
==
--- cfe/trunk/test/ClangScanDeps/static-analyzer.c (original)
+++ cfe/trunk/test/ClangScanDeps/static-analyzer.c Mon Oct 14 14:06:11 2019
@@ -1,12 +1,12 @@
 // RUN: rm -rf %t.dir
-// RUN: rm -rf %t.dir/cdb.json
+// RUN: rm -rf %t-cdb.json
 // RUN: mkdir -p %t.dir
 // RUN: cp %s %t.dir/static-analyzer.c
 // RUN: mkdir %t.dir/Inputs
 // RUN: cp %S/Inputs/header.h %t.dir/Inputs/analyze_header_input.h
-// RUN: sed -e "s|DIR|%t.dir|g" %S/Inputs/static-analyzer-cdb.json > 
%t.dir/cdb.json
+// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/static-analyzer-cdb.json > 
%t-cdb.json
 //
-// RUN: clang-scan-deps -compilation-database %t.dir/cdb.json -j 1 | FileCheck 
%s
+// RUN: clang-scan-deps -compilation-database %t-cdb.json -j 1 | FileCheck %s
 
 #ifdef __clang_analyzer__
 #include "Inputs/analyze_header_input.h"


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


[PATCH] D68528: [Implicit Modules] Add -cc1 option -fmodules-strict-hash which includes search paths and diagnostics.

2019-10-14 Thread Michael Spencer via Phabricator via cfe-commits
Bigcheese marked an inline comment as done.
Bigcheese added inline comments.



Comment at: include/clang/Lex/HeaderSearchOptions.h:209
+  ///
+  /// This includes things like the full header search path.
+  unsigned ModulesStrictHash : 1;

bruno wrote:
> What else do you plan to add in the future as part of "all the things that 
> could impact"? It seems to me that by default this should always be the case, 
> but header search related things are special because one might want to  
> handwave on correctness to have smaller caches (default behavior right now). 
> 
> I wonder if we should instead have `fmodules-strict-header-seach` and later 
> on add a more generic thing that group such cases? WDYT?
This also includes diagnostic options. I'm not sure it's useful for users to 
pick each individual thing they care about for the hash. The intent here is 
just to capture every possible difference we find.


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

https://reviews.llvm.org/D68528



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


r374819 - [OPNEMP]Allow num_tasks clause in combined task-based directives.

2019-10-14 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Mon Oct 14 13:44:34 2019
New Revision: 374819

URL: http://llvm.org/viewvc/llvm-project?rev=374819=rev
Log:
[OPNEMP]Allow num_tasks clause in combined task-based directives.

The expression of the num_tasks clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.

Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/OpenMP/parallel_master_taskloop_ast_print.cpp
cfe/trunk/test/OpenMP/parallel_master_taskloop_codegen.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=374819=374818=374819=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Mon Oct 14 13:44:34 2019
@@ -5375,7 +5375,7 @@ public:
 /// \endcode
 /// In this example directive '#pragma omp taskloop' has clause 'num_tasks'
 /// with single expression '4'.
-class OMPNumTasksClause : public OMPClause {
+class OMPNumTasksClause : public OMPClause, public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -5391,16 +5391,23 @@ public:
   /// Build 'num_tasks' clause.
   ///
   /// \param Size Expression associated with this clause.
+  /// \param HelperSize Helper grainsize for the construct.
+  /// \param CaptureRegion Innermost OpenMP region where expressions in this
+  /// clause must be captured.
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
-  OMPNumTasksClause(Expr *Size, SourceLocation StartLoc,
+  OMPNumTasksClause(Expr *Size, Stmt *HelperSize,
+OpenMPDirectiveKind CaptureRegion, SourceLocation StartLoc,
 SourceLocation LParenLoc, SourceLocation EndLoc)
-  : OMPClause(OMPC_num_tasks, StartLoc, EndLoc), LParenLoc(LParenLoc),
-NumTasks(Size) {}
+  : OMPClause(OMPC_num_tasks, StartLoc, EndLoc), 
OMPClauseWithPreInit(this),
+LParenLoc(LParenLoc), NumTasks(Size) {
+setPreInitStmt(HelperSize, CaptureRegion);
+  }
 
   /// Build an empty clause.
   explicit OMPNumTasksClause()
-  : OMPClause(OMPC_num_tasks, SourceLocation(), SourceLocation()) {}
+  : OMPClause(OMPC_num_tasks, SourceLocation(), SourceLocation()),
+OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -5417,11 +5424,10 @@ public:
 return const_child_range(,  + 1);
   }
 
-  child_range used_children() {
-return child_range(child_iterator(), child_iterator());
-  }
+  child_range used_children();
   const_child_range used_children() const {
-return const_child_range(const_child_iterator(), const_child_iterator());
+auto Children = const_cast(this)->used_children();
+return const_child_range(Children.begin(), Children.end());
   }
 
   static bool classof(const OMPClause *T) {

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=374819=374818=374819=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Oct 14 13:44:34 2019
@@ -3283,6 +3283,7 @@ bool RecursiveASTVisitor::Visit
 template 
 bool RecursiveASTVisitor::VisitOMPNumTasksClause(
 OMPNumTasksClause *C) {
+  TRY_TO(VisitOMPClauseWithPreInit(C));
   TRY_TO(TraverseStmt(C->getNumTasks()));
   return true;
 }

Modified: cfe/trunk/lib/AST/OpenMPClause.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OpenMPClause.cpp?rev=374819=374818=374819=diff
==
--- cfe/trunk/lib/AST/OpenMPClause.cpp (original)
+++ cfe/trunk/lib/AST/OpenMPClause.cpp Mon Oct 14 13:44:34 2019
@@ -86,6 +86,8 @@ const OMPClauseWithPreInit *OMPClauseWit
 return static_cast(C);
   case OMPC_grainsize:
 return static_cast(C);
+  case OMPC_num_tasks:
+return static_cast(C);
   case OMPC_default:
   case OMPC_proc_bind:
   case OMPC_final:
@@ -116,7 +118,6 @@ const OMPClauseWithPreInit *OMPClauseWit
   case OMPC_map:
   case OMPC_priority:
   case OMPC_nogroup:
-  case OMPC_num_tasks:
   case OMPC_hint:
   case OMPC_defaultmap:
   case OMPC_unknown:
@@ -241,6 +242,12 @@ OMPClause::child_range OMPGrainsizeClaus
   return child_range(,  + 1);
 }
 
+OMPClause::child_range OMPNumTasksClause::used_children() {
+  if (Stmt **C = getAddrOfExprAsWritten(getPreInitStmt()))
+

[PATCH] D41284: [Concepts] Associated constraints infrastructure.

2019-10-14 Thread Saar Raz via Phabricator via cfe-commits
saar.raz updated this revision to Diff 224898.
saar.raz marked 15 inline comments as done.
saar.raz added a comment.

Remove unrelated cleanup


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D41284

Files:
  clang/include/clang/AST/ASTNodeTraverser.h
  clang/include/clang/AST/DeclTemplate.h
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/DeclTemplate.cpp
  clang/lib/Sema/SemaConcept.cpp
  clang/lib/Sema/SemaTemplate.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/lib/Serialization/ASTReader.cpp
  clang/lib/Serialization/ASTReaderDecl.cpp
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Serialization/ASTWriterDecl.cpp
  clang/test/CXX/concepts-ts/temp/concept/p4.cpp
  
clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
  
clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/func-template-decl.cpp
  
clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/var-template-decl.cpp

Index: clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/var-template-decl.cpp
===
--- /dev/null
+++ clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/var-template-decl.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s
+
+namespace nodiag {
+
+struct B {
+template  requires bool(T())
+static int A;
+};
+
+template  requires bool(U())
+int B::A = int(U());
+
+} // end namespace nodiag
+
+namespace diag {
+
+struct B {
+template  requires bool(T()) // expected-note{{previous template declaration is here}}
+static int A;
+};
+
+template  requires !bool(U())  // expected-error{{requires clause differs in template redeclaration}}
+int B::A = int(U());
+
+} // end namespace diag
\ No newline at end of file
Index: clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/func-template-decl.cpp
===
--- /dev/null
+++ clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/func-template-decl.cpp
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s
+
+namespace nodiag {
+
+template  requires bool(T())
+int A();
+template  requires bool(U())
+int A();
+
+} // end namespace nodiag
+
+namespace diag {
+
+namespace orig {
+  template  requires true
+  int A();
+  template 
+  int B();
+  template  requires true
+  int C();
+}
+
+template 
+int orig::A();
+// expected-error@-1{{out-of-line declaration of 'A' does not match any declaration in namespace 'diag::orig'}}
+template  requires true
+int orig::B();
+// expected-error@-1{{out-of-line declaration of 'B' does not match any declaration in namespace 'diag::orig'}}
+template  requires !0
+int orig::C();
+// expected-error@-1{{out-of-line declaration of 'C' does not match any declaration in namespace 'diag::orig'}}
+
+} // end namespace diag
+
+namespace nodiag {
+
+struct AA {
+  template  requires someFunc(T())
+  int A();
+};
+
+template  requires someFunc(T())
+int AA::A() { return sizeof(T); }
+
+} // end namespace nodiag
+
+namespace diag {
+
+template 
+struct TA {
+  template  class TT> requires TT::happy
+  int A();
+};
+
+template 
+template  class TT> int TA::A() { return sizeof(TT); }
+// expected-error@-1{{out-of-line definition of 'A' does not match any declaration in 'TA'}}
+
+} // end namespace diag
Index: clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
===
--- clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
+++ clang/test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s
+// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s
 
 namespace nodiag {
 
@@ -13,15 +13,15 @@
 
 template  requires true // expected-note{{previous template declaration is here}}
 struct A;
-template  struct A; // expected-error{{associated constraints differ in template redeclaration}}
+template  struct A; // expected-error{{requires clause differs in template redeclaration}}
 
 template  struct B; // expected-note{{previous template declaration is here}}
-template  requires true // expected-error{{associated constraints differ in template redeclaration}}
+template  requires true // expected-error{{requires clause differs in template redeclaration}}
 struct B;
 
 template  requires true // expected-note{{previous template declaration is here}}
 struct C;
-template  requires !0 // expected-error{{associated constraints differ in template redeclaration}}
+template  requires !0 // expected-error{{requires clause differs in template redeclaration}}
 struct C;
 
 } 

[PATCH] D68093: [clang-scan-deps][static analyzer] Support for clang --analyze in scan-deps

2019-10-14 Thread Jan Korous via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc5d14b5c6fa9: [clang-scan-deps] Support for clang --analyze 
in clang-scan-deps (authored by jkorous).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68093

Files:
  clang-tools-extra/clang-tidy/ClangTidy.cpp
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Lex/PreprocessorOptions.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Analysis/preprocessor-setup.c
  clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json
  clang/test/ClangScanDeps/static-analyzer.c
  llvm/utils/lit/lit/llvm/config.py

Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -402,7 +402,7 @@
 builtin_include_dir = self.get_clang_builtin_include_dir(self.config.clang)
 tool_substitutions = [
 ToolSubst('%clang', command=self.config.clang, extra_args=additional_flags),
-ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze']+additional_flags),
+ToolSubst('%clang_analyze_cc1', command='%clang_cc1', extra_args=['-analyze', '%analyze', '-setup-static-analyzer']+additional_flags),
 ToolSubst('%clang_cc1', command=self.config.clang, extra_args=['-cc1', '-internal-isystem', builtin_include_dir, '-nostdsysteminc']+additional_flags),
 ToolSubst('%clang_cpp', command=self.config.clang, extra_args=['--driver-mode=cpp']+additional_flags),
 ToolSubst('%clang_cl', command=self.config.clang, extra_args=['--driver-mode=cl']+additional_flags),
Index: clang/test/ClangScanDeps/static-analyzer.c
===
--- /dev/null
+++ clang/test/ClangScanDeps/static-analyzer.c
@@ -0,0 +1,16 @@
+// RUN: rm -rf %t.dir
+// RUN: rm -rf %t.dir/cdb.json
+// RUN: mkdir -p %t.dir
+// RUN: cp %s %t.dir/static-analyzer.c
+// RUN: mkdir %t.dir/Inputs
+// RUN: cp %S/Inputs/header.h %t.dir/Inputs/analyze_header_input.h
+// RUN: sed -e "s|DIR|%t.dir|g" %S/Inputs/static-analyzer-cdb.json > %t.dir/cdb.json
+//
+// RUN: clang-scan-deps -compilation-database %t.dir/cdb.json -j 1 | FileCheck %s
+
+#ifdef __clang_analyzer__
+#include "Inputs/analyze_header_input.h"
+#endif
+
+// CHECK: analyze_header_input.h
+
Index: clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json
===
--- /dev/null
+++ clang/test/ClangScanDeps/Inputs/static-analyzer-cdb.json
@@ -0,0 +1,7 @@
+[
+{
+  "directory": "DIR",
+  "command": "clang --analyze DIR/static-analyzer.c",
+  "file": "DIR/static-analyzer.c"
+}
+]
Index: clang/test/Analysis/preprocessor-setup.c
===
--- /dev/null
+++ clang/test/Analysis/preprocessor-setup.c
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -E -setup-static-analyzer %s
+
+#ifndef __clang_analyzer__
+#error __clang_analyzer__ not defined
+#endif
Index: clang/lib/Frontend/InitPreprocessor.cpp
===
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -560,6 +560,7 @@
 static void InitializePredefinedMacros(const TargetInfo ,
const LangOptions ,
const FrontendOptions ,
+   const PreprocessorOptions ,
MacroBuilder ) {
   // Compiler version introspection macros.
   Builder.defineMacro("__llvm__");  // LLVM Backend
@@ -997,8 +998,7 @@
   else if (LangOpts.getStackProtector() == LangOptions::SSPReq)
 Builder.defineMacro("__SSP_ALL__", "3");
 
-  // Define a macro that exists only when using the static analyzer.
-  if (FEOpts.ProgramAction == frontend::RunAnalysis)
+  if (PPOpts.SetUpStaticAnalyzer)
 Builder.defineMacro("__clang_analyzer__");
 
   if (LangOpts.FastRelaxedMath)
@@ -1125,9 +1125,10 @@
 // macros. This is not the right way to handle this.
 if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo())
   InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
- Builder);
+ PP.getPreprocessorOpts(), Builder);
 
-InitializePredefinedMacros(PP.getTargetInfo(), LangOpts, FEOpts, Builder);
+InitializePredefinedMacros(PP.getTargetInfo(), LangOpts, FEOpts,
+   PP.getPreprocessorOpts(), Builder);
 
 // Install definitions to make Objective-C++ ARC work well with various
 // C++ Standard Library 

[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-14 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

Based on what we learned in https://llvm.org/PR43530, I think we still want to 
use the location of the call site and not line zero. :(




Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1431
+}
+BI->setDebugLoc(TheCallDL);
+continue;

aprantl wrote:
> I still think an artificial (line 0) location would be less misleading for 
> debuggers, profilers, and optimization remarks.
That will cause problems for us in practice. There's discussion about this in 
D68747. Since that change, we treat line zero the same as "no location". If 
there are no locations in a basic block, then the whole block inherits the line 
number from the block layout predecessor, which could be unrelated. Keeping the 
inlined call site location gives us the highest likelihood that "step over" 
will stop at the next statement. Widely applying line zero to entire basic 
blocks will put us in that situation more often. We could certainly write a 
pass to backfill better source locations, but it seems preferable to not put 
ourselves in that position in the first place.

However, the effect you mention on profilers and optimization remarks is real 
and concerning. Users should have the power to work around it by removing the 
flag that applies this attribute, which makes me feel like we should go forward 
with this as is. If this develops into a real usability problem, we can leave 
the attribute as is and move the implementation into the backend.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67723



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


r374815 - [clang-scan-deps] Support for clang --analyze in clang-scan-deps

2019-10-14 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Mon Oct 14 13:15:01 2019
New Revision: 374815

URL: http://llvm.org/viewvc/llvm-project?rev=374815=rev
Log:
[clang-scan-deps] Support for clang --analyze in clang-scan-deps

The goal is to have 100% fidelity in clang-scan-deps behavior when
--analyze is present in compilation command.

At the same time I don't want to break clang-tidy which expects
__static_analyzer__ macro defined as built-in.

I introduce new cc1 options (-setup-static-analyzer) that controls
the macro definition and is conditionally set in driver.

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

Added:
cfe/trunk/test/Analysis/preprocessor-setup.c
cfe/trunk/test/ClangScanDeps/Inputs/static-analyzer-cdb.json
cfe/trunk/test/ClangScanDeps/static-analyzer.c
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Lex/PreprocessorOptions.h
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=374815=374814=374815=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Oct 14 13:15:01 2019
@@ -846,6 +846,8 @@ def preamble_bytes_EQ : Joined<["-"], "p
"covering the first N bytes of the main file">;
 def detailed_preprocessing_record : Flag<["-"], 
"detailed-preprocessing-record">,
   HelpText<"include a detailed record of preprocessing actions">;
+def setup_static_analyzer : Flag<["-"], "setup-static-analyzer">,
+  HelpText<"Set up preprocessor for static analyzer (done automatically when 
static analyzer is run).">;
 
 
//===--===//
 // OpenCL Options

Modified: cfe/trunk/include/clang/Lex/PreprocessorOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PreprocessorOptions.h?rev=374815=374814=374815=diff
==
--- cfe/trunk/include/clang/Lex/PreprocessorOptions.h (original)
+++ cfe/trunk/include/clang/Lex/PreprocessorOptions.h Mon Oct 14 13:15:01 2019
@@ -181,6 +181,9 @@ public:
   ExcludedPreprocessorDirectiveSkipMapping
   *ExcludedConditionalDirectiveSkipMappings = nullptr;
 
+  /// Set up preprocessor for RunAnalysis action.
+  bool SetUpStaticAnalyzer = false;
+
 public:
   PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {}
 

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374815=374814=374815=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Oct 14 13:15:01 2019
@@ -3803,6 +3803,10 @@ void Clang::ConstructJob(Compilation ,
   if (isa(JA))
 RenderAnalyzerOptions(Args, CmdArgs, Triple, Input);
 
+  if (isa(JA) ||
+  (isa(JA) && Args.hasArg(options::OPT__analyze)))
+CmdArgs.push_back("-setup-static-analyzer");
+
   // Enable compatilibily mode to avoid analyzer-config related errors.
   // Since we can't access frontend flags through hasArg, let's manually 
iterate
   // through them.

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=374815=374814=374815=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Oct 14 13:15:01 2019
@@ -3349,6 +3349,8 @@ static void ParsePreprocessorArgs(Prepro
   // "editor placeholder in source file" error in PP only mode.
   if (isStrictlyPreprocessorAction(Action))
 Opts.LexEditorPlaceholders = false;
+
+  Opts.SetUpStaticAnalyzer = Args.hasArg(OPT_setup_static_analyzer);
 }
 
 static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions ,

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=374815=374814=374815=diff
==
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Oct 14 13:15:01 2019
@@ -560,6 +560,7 @@ static void InitializeCPlusPlusFeatureTe
 static void InitializePredefinedMacros(const TargetInfo ,
const LangOptions ,
const FrontendOptions ,
+   const PreprocessorOptions ,
MacroBuilder ) {
   // 

[clang-tools-extra] r374815 - [clang-scan-deps] Support for clang --analyze in clang-scan-deps

2019-10-14 Thread Jan Korous via cfe-commits
Author: jkorous
Date: Mon Oct 14 13:15:01 2019
New Revision: 374815

URL: http://llvm.org/viewvc/llvm-project?rev=374815=rev
Log:
[clang-scan-deps] Support for clang --analyze in clang-scan-deps

The goal is to have 100% fidelity in clang-scan-deps behavior when
--analyze is present in compilation command.

At the same time I don't want to break clang-tidy which expects
__static_analyzer__ macro defined as built-in.

I introduce new cc1 options (-setup-static-analyzer) that controls
the macro definition and is conditionally set in driver.

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

Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=374815=374814=374815=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Mon Oct 14 13:15:01 2019
@@ -33,6 +33,7 @@
 #include "clang/Frontend/TextDiagnosticPrinter.h"
 #include "clang/Lex/PPCallbacks.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Rewrite/Frontend/FixItRewriter.h"
 #include "clang/Rewrite/Frontend/FrontendActions.h"
 #include "clang/Tooling/Core/Diagnostic.h"
@@ -539,10 +540,8 @@ runClangTidy(clang::tidy::ClangTidyConte
FileManager *Files,
std::shared_ptr PCHContainerOps,
DiagnosticConsumer *DiagConsumer) override {
-  // Explicitly set ProgramAction to RunAnalysis to make the preprocessor
-  // define __clang_analyzer__ macro. The frontend analyzer action will not
-  // be called here.
-  Invocation->getFrontendOpts().ProgramAction = frontend::RunAnalysis;
+  // Explicitly ask to define __clang_analyzer__ macro.
+  Invocation->getPreprocessorOpts().SetUpStaticAnalyzer = true;
   return FrontendActionFactory::runInvocation(
   Invocation, Files, PCHContainerOps, DiagConsumer);
 }


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


r374810 - [OPNEMP]Allow grainsize clause in combined task-based directives.

2019-10-14 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Mon Oct 14 12:29:52 2019
New Revision: 374810

URL: http://llvm.org/viewvc/llvm-project?rev=374810=rev
Log:
[OPNEMP]Allow grainsize clause in combined task-based directives.

The expression of the grainsize clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.

Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/OpenMP/parallel_master_taskloop_codegen.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=374810=374809=374810=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Mon Oct 14 12:29:52 2019
@@ -5268,7 +5268,7 @@ public:
 /// \endcode
 /// In this example directive '#pragma omp taskloop' has clause 'grainsize'
 /// with single expression '4'.
-class OMPGrainsizeClause : public OMPClause {
+class OMPGrainsizeClause : public OMPClause, public OMPClauseWithPreInit {
   friend class OMPClauseReader;
 
   /// Location of '('.
@@ -5284,16 +5284,23 @@ public:
   /// Build 'grainsize' clause.
   ///
   /// \param Size Expression associated with this clause.
+  /// \param HelperSize Helper grainsize for the construct.
+  /// \param CaptureRegion Innermost OpenMP region where expressions in this
+  /// clause must be captured.
   /// \param StartLoc Starting location of the clause.
   /// \param EndLoc Ending location of the clause.
-  OMPGrainsizeClause(Expr *Size, SourceLocation StartLoc,
+  OMPGrainsizeClause(Expr *Size, Stmt *HelperSize,
+ OpenMPDirectiveKind CaptureRegion, SourceLocation 
StartLoc,
  SourceLocation LParenLoc, SourceLocation EndLoc)
-  : OMPClause(OMPC_grainsize, StartLoc, EndLoc), LParenLoc(LParenLoc),
-Grainsize(Size) {}
+  : OMPClause(OMPC_grainsize, StartLoc, EndLoc), 
OMPClauseWithPreInit(this),
+LParenLoc(LParenLoc), Grainsize(Size) {
+setPreInitStmt(HelperSize, CaptureRegion);
+  }
 
   /// Build an empty clause.
   explicit OMPGrainsizeClause()
-  : OMPClause(OMPC_grainsize, SourceLocation(), SourceLocation()) {}
+  : OMPClause(OMPC_grainsize, SourceLocation(), SourceLocation()),
+OMPClauseWithPreInit(this) {}
 
   /// Sets the location of '('.
   void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
@@ -5310,11 +5317,10 @@ public:
 return const_child_range(,  + 1);
   }
 
-  child_range used_children() {
-return child_range(child_iterator(), child_iterator());
-  }
+  child_range used_children();
   const_child_range used_children() const {
-return const_child_range(const_child_iterator(), const_child_iterator());
+auto Children = const_cast(this)->used_children();
+return const_child_range(Children.begin(), Children.end());
   }
 
   static bool classof(const OMPClause *T) {

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=374810=374809=374810=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Oct 14 12:29:52 2019
@@ -3275,6 +3275,7 @@ bool RecursiveASTVisitor::Visit
 template 
 bool RecursiveASTVisitor::VisitOMPGrainsizeClause(
 OMPGrainsizeClause *C) {
+  TRY_TO(VisitOMPClauseWithPreInit(C));
   TRY_TO(TraverseStmt(C->getGrainsize()));
   return true;
 }

Modified: cfe/trunk/lib/AST/OpenMPClause.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/OpenMPClause.cpp?rev=374810=374809=374810=diff
==
--- cfe/trunk/lib/AST/OpenMPClause.cpp (original)
+++ cfe/trunk/lib/AST/OpenMPClause.cpp Mon Oct 14 12:29:52 2019
@@ -84,6 +84,8 @@ const OMPClauseWithPreInit *OMPClauseWit
 return static_cast(C);
   case OMPC_device:
 return static_cast(C);
+  case OMPC_grainsize:
+return static_cast(C);
   case OMPC_default:
   case OMPC_proc_bind:
   case OMPC_final:
@@ -113,7 +115,6 @@ const OMPClauseWithPreInit *OMPClauseWit
   case OMPC_simd:
   case OMPC_map:
   case OMPC_priority:
-  case OMPC_grainsize:
   case OMPC_nogroup:
   case OMPC_num_tasks:
   case OMPC_hint:
@@ -234,6 +235,12 @@ OMPClause::child_range OMPIfClause::used
   return child_range(,  + 1);
 }
 
+OMPClause::child_range OMPGrainsizeClause::used_children() {
+  if (Stmt **C = getAddrOfExprAsWritten(getPreInitStmt()))
+return child_range(C, C + 1);
+  return child_range(,  + 

[PATCH] D68896: PR43080: Do not build context-sensitive expressions during name classification.

2019-10-14 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM

> I'm inclined to defer doing that for now, if that's OK :)

Sure.




Comment at: lib/Sema/SemaDecl.cpp:1191
+  return NameClassification::ContextIndependentExpr(
+  BuildDeclarationNameExpr(SS, Result, ADL));
+}

rsmith wrote:
> efriedma wrote:
> > This doesn't depend on the context... because we're going to throw away the 
> > expression later anyway?  I guess that makes sense.
> Yes, basically; we don't do anything context-dependent right now when 
> building the `UnresolvedLookupExpr`, it's all delayed until we resolve the 
> overload set. I suppose I could make this more explicit by directly creating 
> the `UnresolvedLookupExpr` here, at the cost of duplicating a little of the 
> work done by `BuildDeclarationNameExpr`. WDYT?
I don't think duplicating the code really helps; the comment makes it clear 
enough what's happening here.


Repository:
  rC Clang

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

https://reviews.llvm.org/D68896



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


[PATCH] D68346: [clang-format] Add new option to add spaces around conditions

2019-10-14 Thread Tim Wojtulewicz via Phabricator via cfe-commits
timwoj added a comment.

In D68346#1708384 , @timwoj wrote:

> Changed option name to SpacesInConditionalStatement, added 
> isKeywordWithCondition method, added some extra tests


Sorry for the delay on getting back to this. I'm not the original author and I 
was waiting for changes from him, and then I slacked on getting them submitted.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68346



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


[PATCH] D68346: [clang-format] Add new option to add spaces around conditions

2019-10-14 Thread Tim Wojtulewicz via Phabricator via cfe-commits
timwoj updated this revision to Diff 224890.
timwoj added a comment.

Changed option name to SpacesInConditionalStatement, added 
isKeywordWithCondition method, added some extra tests


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68346

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTest.cpp

Index: clang/unittests/Format/FormatTest.cpp
===
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -12165,6 +12165,7 @@
   CHECK_PARSE_BOOL(SpacesInParentheses);
   CHECK_PARSE_BOOL(SpacesInSquareBrackets);
   CHECK_PARSE_BOOL(SpacesInAngles);
+  CHECK_PARSE_BOOL(SpacesInConditionalStatement);
   CHECK_PARSE_BOOL(SpaceInEmptyBlock);
   CHECK_PARSE_BOOL(SpaceInEmptyParentheses);
   CHECK_PARSE_BOOL(SpacesInContainerLiterals);
@@ -14373,6 +14374,23 @@
   verifyFormat("auto lambda = [ = a]() { a = 2; };", AlignStyle);
 }
 
+TEST_F(FormatTest, SpacesInConditionalStatement) {
+  FormatStyle Spaces = getLLVMStyle();
+  Spaces.SpacesInConditionalStatement = true;
+  verifyFormat("for ( int i = 0; i; i++ )\n  continue;", Spaces);
+  verifyFormat("if ( !a )\n  return;", Spaces);
+  verifyFormat("if ( a )\n  return;", Spaces);
+  verifyFormat("if constexpr ( a )\n  return;", Spaces);
+  verifyFormat("switch ( a )\ncase 1:\n  return;", Spaces);
+  verifyFormat("while ( a )\n  return;", Spaces);
+  verifyFormat("while ( (a && b) )\n  return;", Spaces);
+  verifyFormat("do {\n} while ( 1 != 0 );", Spaces);
+
+  // Check that space on the left of "::" is inserted as expected at beginning
+  // of condition.
+  verifyFormat("while ( ::func() )\n  return;", Spaces);
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -2489,6 +2489,13 @@
   Right.ParameterCount > 0);
 }
 
+/// Returns \c true if the token is followed by a boolean condition, \c false
+/// otherwise.
+static bool isKeywordWithCondition(const FormatToken ) {
+  return Tok.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while, tok::kw_switch,
+ tok::kw_constexpr);
+};
+
 bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine ,
   const FormatToken ,
   const FormatToken ) {
@@ -2505,6 +2512,16 @@
 return Right.is(tok::hash);
   if (Left.is(tok::l_paren) && Right.is(tok::r_paren))
 return Style.SpaceInEmptyParentheses;
+  if (Style.SpacesInConditionalStatement) {
+if (Left.is(tok::l_paren) && Left.Previous &&
+isKeywordWithCondition(*Left.Previous) )
+  return true;
+if (Right.is(tok::r_paren) &&
+Right.MatchingParen &&
+Right.MatchingParen->Previous &&
+isKeywordWithCondition(*Right.MatchingParen->Previous))
+  return true;
+  }
   if (Left.is(tok::l_paren) || Right.is(tok::r_paren))
 return (Right.is(TT_CastRParen) ||
 (Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen)))
@@ -2903,7 +2920,8 @@
 // The identifier might actually be a macro name such as ALWAYS_INLINE. If
 // this turns out to be too lenient, add analysis of the identifier itself.
 return Right.WhitespaceRange.getBegin() != Right.WhitespaceRange.getEnd();
-  if (Right.is(tok::coloncolon) && !Left.isOneOf(tok::l_brace, tok::comment))
+  if (Right.is(tok::coloncolon) &&
+  !Left.isOneOf(tok::l_brace, tok::comment, tok::l_paren))
 return (Left.is(TT_TemplateOpener) &&
 Style.Standard < FormatStyle::LS_Cpp11) ||
!(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square,
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -511,6 +511,7 @@
 IO.mapOptional("SpacesBeforeTrailingComments",
Style.SpacesBeforeTrailingComments);
 IO.mapOptional("SpacesInAngles", Style.SpacesInAngles);
+IO.mapOptional("SpacesInConditionalStatement", Style.SpacesInConditionalStatement);
 IO.mapOptional("SpacesInContainerLiterals",
Style.SpacesInContainerLiterals);
 IO.mapOptional("SpacesInCStyleCastParentheses",
@@ -775,6 +776,7 @@
   LLVMStyle.SpaceBeforeAssignmentOperators = true;
   LLVMStyle.SpaceBeforeCpp11BracedList = false;
   LLVMStyle.SpacesInAngles = false;
+  LLVMStyle.SpacesInConditionalStatement = false;
 
   LLVMStyle.PenaltyBreakAssignment = prec::Assignment;
   LLVMStyle.PenaltyBreakComment = 300;
Index: clang/include/clang/Format/Format.h

[PATCH] D67723: [DebugInfo] Add option to disable inline line tables.

2019-10-14 Thread Amy Huang via Phabricator via cfe-commits
akhuang updated this revision to Diff 224888.
akhuang added a comment.

- Set inlined locations to line 0
- Fix to remove all debug info intrinsics


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67723

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-no-inline-line-tables.c
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/Attributes.td
  llvm/lib/Transforms/Utils/InlineFunction.cpp
  llvm/test/Transforms/Inline/no-inline-line-tables.ll

Index: llvm/test/Transforms/Inline/no-inline-line-tables.ll
===
--- /dev/null
+++ llvm/test/Transforms/Inline/no-inline-line-tables.ll
@@ -0,0 +1,64 @@
+; RUN: opt < %s -inline -S | FileCheck %s
+
+; This tests that functions with the attribute `no-inline-line-tables` have the
+; correct debug information when they are inlined.
+
+; ModuleID = 't.c'
+source_filename = "t.c"
+target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-windows-msvc"
+
+; Function Attrs: alwaysinline nounwind
+define dso_local i32 @f(i32 %i) #0 !dbg !7 {
+entry:
+  %i.addr = alloca i32, align 4
+  store i32 %i, i32* %i.addr, align 4
+  call void @llvm.dbg.declare(metadata i32* %i.addr, metadata !12, metadata !DIExpression()), !dbg !13
+  %0 = load i32, i32* %i.addr, align 4, !dbg !14
+  ret i32 %0, !dbg !14
+}
+
+; Function Attrs: nounwind readnone speculatable willreturn
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+
+; Check that debug info for inlined code uses line 0 and that debug intrinsics
+; are removed.
+; Function Attrs: noinline nounwind optnone
+define dso_local i32 @main() #2 !dbg !15 {
+entry:
+; CHECK-LABEL: @main()
+; CHECK-NOT: @f
+; CHECK-NOT: @llvm.dbg.declare
+; CHECK: %{{[0-9]+}} = load i32, i32* %i.addr.i, align 4, !dbg ![[VAR:[0-9]+]]
+; CHECK: ![[VAR]] = !DILocation(line: 0, scope: !{{[0-9]+}})
+  %call = call i32 @f(i32 23), !dbg !18
+  ret i32 0, !dbg !19
+}
+
+attributes #0 = { alwaysinline nounwind "no-inline-line-tables" }
+attributes #2 = { noinline nounwind optnone "no-inline-line-tables"}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5}
+!llvm.ident = !{!6}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git cb37bd6bbb4ca4b23838b08412d976bdab07e4fe)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: "", directory: "/usr/local/google/home/akhuang/testing/inline-line-tables", checksumkind: CSK_MD5, checksum: "69f4cc67a00fe0c3f251a593209753fd")
+!2 = !{}
+!3 = !{i32 2, !"CodeView", i32 1}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 2}
+!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git cb37bd6bbb4ca4b23838b08412d976bdab07e4fe)"}
+!7 = distinct !DISubprogram(name: "f", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!8 = !DIFile(filename: "t.c", directory: "/usr/local/google/home/akhuang/testing/inline-line-tables", checksumkind: CSK_MD5, checksum: "69f4cc67a00fe0c3f251a593209753fd")
+!9 = !DISubroutineType(types: !10)
+!10 = !{!11, !11}
+!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!12 = !DILocalVariable(name: "i", arg: 1, scope: !7, file: !8, line: 1, type: !11)
+!13 = !DILocation(line: 1, scope: !7)
+!14 = !DILocation(line: 2, scope: !7)
+!15 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 4, type: !16, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!16 = !DISubroutineType(types: !17)
+!17 = !{!11}
+!18 = !DILocation(line: 5, scope: !15)
+!19 = !DILocation(line: 6, scope: !15)
Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
===
--- llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1405,6 +1405,10 @@
   // other.
   DenseMap IANodes;
 
+  // Check if we are not generating inline line tables and want to use
+  // the call site location instead.
+  bool NoInlineLineTables = Fn->hasFnAttribute("no-inline-line-tables");
+
   for (; FI != Fn->end(); ++FI) {
 for (BasicBlock::iterator BI = FI->begin(), BE = FI->end();
  BI != BE; ++BI) {
@@ -1416,6 +1420,19 @@
 BI->setMetadata(LLVMContext::MD_loop, NewLoopID);
   }
 
+  // If we are not generating inline line tables, set the debug location
+  // of the inlined code to be the call location.
+  if (NoInlineLineTables) {
+// Remove debug info intrinsics.
+

[PATCH] D68953: Enable most VFS tests on Windows

2019-10-14 Thread Adrian McCarthy via Phabricator via cfe-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Inconsistencies in when/if paths are cannoicalized prevented VFS tests from 
working on Windows.  This fixes the primary cause and enables most of the tests 
(15/20).

Remaining VFS tests are still XFAILed on Windows because there are additional 
causes in some code paths.  I plan to diagnose and correct those in a future 
patch.


https://reviews.llvm.org/D68953

Files:
  clang/lib/Lex/HeaderSearch.cpp
  clang/test/VFS/external-names.c
  clang/test/VFS/framework-import.m
  clang/test/VFS/implicit-include.c
  clang/test/VFS/include-mixed-real-and-virtual.c
  clang/test/VFS/include-real-from-virtual.c
  clang/test/VFS/include-virtual-from-real.c
  clang/test/VFS/include.c
  clang/test/VFS/incomplete-umbrella.m
  clang/test/VFS/module-import.m
  clang/test/VFS/real-path-found-first.m
  clang/test/VFS/relative-path.c
  clang/test/VFS/umbrella-framework-import-skipnonexist.m
  llvm/lib/Support/VirtualFileSystem.cpp

Index: llvm/lib/Support/VirtualFileSystem.cpp
===
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -1303,16 +1303,15 @@
   return nullptr;
 
 NameValueNode = I.getValue();
+SmallString<256> Path(Value);
 if (FS->UseCanonicalizedPaths) {
-  SmallString<256> Path(Value);
   // Guarantee that old YAML files containing paths with ".." and "."
   // are properly canonicalized before read into the VFS.
   Path = sys::path::remove_leading_dotslash(Path);
   sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
-  Name = Path.str();
-} else {
-  Name = Value;
 }
+sys::path::native(Path);
+Name = Path.str();
   } else if (Key == "type") {
 if (!parseScalarString(I.getValue(), Value, Buffer))
   return nullptr;
@@ -1371,6 +1370,7 @@
   FullPath = sys::path::remove_leading_dotslash(FullPath);
   sys::path::remove_dots(FullPath, /*remove_dot_dot=*/true);
 }
+sys::path::native(FullPath);
 ExternalContentsPath = FullPath.str();
   } else if (Key == "use-external-name") {
 bool Val;
@@ -1831,11 +1831,12 @@
   RedirectingFileSystem *VFS = RedirectingFileSystem::create(
   std::move(Buffer), DiagHandler, YAMLFilePath, DiagContext,
   std::move(ExternalFS));
-  ErrorOr RootE = VFS->lookupPath("/");
+  ErrorOr RootE =
+  VFS->lookupPath(sys::path::get_separator());
   if (!RootE)
 return;
   SmallVector Components;
-  Components.push_back("/");
+  Components.push_back(sys::path::get_separator());
   getVFSEntries(*RootE, Components, CollectedEntries);
 }
 
Index: clang/test/VFS/umbrella-framework-import-skipnonexist.m
===
--- clang/test/VFS/umbrella-framework-import-skipnonexist.m
+++ clang/test/VFS/umbrella-framework-import-skipnonexist.m
@@ -1,8 +1,5 @@
 // REQUIRES: crash-recovery
 
-// FIXME: PR43272
-// XFAIL: system-windows
-
 // RUN: rm -rf %t
 // RUN: mkdir -p %t/vdir %t/outdir %t/cache
 // RUN: cp -R %S/Inputs/Bar.framework %t/outdir/
Index: clang/test/VFS/relative-path.c
===
--- clang/test/VFS/relative-path.c
+++ clang/test/VFS/relative-path.c
@@ -3,9 +3,6 @@
 // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml
 // RUN: %clang_cc1 -Werror -I . -ivfsoverlay %t.yaml -fsyntax-only %s
 
-// FIXME: PR43272
-// XFAIL: system-windows
-
 #include "not_real.h"
 
 void foo() {
Index: clang/test/VFS/real-path-found-first.m
===
--- clang/test/VFS/real-path-found-first.m
+++ clang/test/VFS/real-path-found-first.m
@@ -4,9 +4,6 @@
 // intentionally rebuild modules, since the precompiled module file refers to
 // the dependency files by real path.
 
-// FIXME: PR43272
-// XFAIL: system-windows
-
 // RUN: rm -rf %t %t-cache %t.pch
 // RUN: mkdir -p %t/SomeFramework.framework/Modules
 // RUN: cat %S/Inputs/some_frame_module.map > %t/SomeFramework.framework/Modules/module.modulemap
Index: clang/test/VFS/module-import.m
===
--- clang/test/VFS/module-import.m
+++ clang/test/VFS/module-import.m
@@ -2,9 +2,6 @@
 // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" %S/Inputs/vfsoverlay.yaml > %t.yaml
 // RUN: %clang_cc1 -Werror -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s
 
-// FIXME: PR43272
-// XFAIL: system-windows
-
 @import not_real;
 
 void foo() {
Index: clang/test/VFS/incomplete-umbrella.m
===
--- clang/test/VFS/incomplete-umbrella.m
+++ 

r374805 - [clang][IFS][test] Fixing lit test breakages on macOS due to r374798

2019-10-14 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Oct 14 11:57:29 2019
New Revision: 374805

URL: http://llvm.org/viewvc/llvm-project?rev=374805=rev
Log:
[clang][IFS][test] Fixing lit test breakages on macOS due to r374798

Adding the quotes breaks tests because on Darwin the name mangling is prefixed
with an underscore.

Modified:
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/object.c

Modified: cfe/trunk/test/InterfaceStubs/inline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=374805=374804=374805=diff
==
--- cfe/trunk/test/InterfaceStubs/inline.c (original)
+++ cfe/trunk/test/InterfaceStubs/inline.c Mon Oct 14 11:57:29 2019
@@ -56,8 +56,8 @@ INLINE int foo() {
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI-DAG: "foo" : { Type: Func }
-// CHECK-TAPI-DAG: "foo.var" : { Type: Object, Size: 4 }
+// CHECK-TAPI-DAG: foo" : { Type: Func }
+// CHECK-TAPI-DAG: foo.var" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS-DAG: foo
 // CHECK-SYMBOLS-DAG: foo.var
 #include "inline.h"

Modified: cfe/trunk/test/InterfaceStubs/object.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=374805=374804=374805=diff
==
--- cfe/trunk/test/InterfaceStubs/object.c (original)
+++ cfe/trunk/test/InterfaceStubs/object.c Mon Oct 14 11:57:29 2019
@@ -2,6 +2,6 @@
 // RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | 
FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI: "data" : { Type: Object, Size: 4 }
+// CHECK-TAPI: data" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data
 int data = 42;


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


[PATCH] D68884: Add support to -Wa,-W in clang

2019-10-14 Thread Brian Cain via Phabricator via cfe-commits
bcain accepted this revision.
bcain 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/D68884/new/

https://reviews.llvm.org/D68884



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


[PATCH] D66827: Add support for MS qualifiers __ptr32, __ptr64, __sptr, __uptr.

2019-10-14 Thread Fabian Maurer via Phabricator via cfe-commits
DarkShadow44 added a comment.

@akhuang 
Any update on this? I'd love to see this upstreamed. I'd offer to help, but I'm 
not well versed in clang.

FWIW, I also found a small bug when using this patchset:

  void func1(void * __ptr32 test) { 
  }
  int main() {
func1(0);
return 0;
  }

gives

  fatal error: error in backend: Cannot emit physreg copy instruction

This only happens when passing a 0. If you pass 1, for example, it gives a 
warning (because of no cast) but compiles.
Tested against MSCV, which compiles the code without problems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66827



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


[PATCH] D67901: [clangd] Improve semantic highlighting in dependent contexts (fixes #154)

2019-10-14 Thread Nathan Ridge via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG37e31e629dc1: [clangd] Improve semantic highlighting in 
dependent contexts (fixes #154) (authored by nridge).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67901

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/SemanticHighlighting.h
  clang-tools-extra/clangd/test/semantic-highlighting.test
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -51,6 +51,9 @@
   {HighlightingKind::StaticField, "StaticField"},
   {HighlightingKind::Method, "Method"},
   {HighlightingKind::StaticMethod, "StaticMethod"},
+  {HighlightingKind::Typedef, "Typedef"},
+  {HighlightingKind::DependentType, "DependentType"},
+  {HighlightingKind::DependentName, "DependentName"},
   {HighlightingKind::TemplateParameter, "TemplateParameter"},
   {HighlightingKind::Primitive, "Primitive"},
   {HighlightingKind::Macro, "Macro"}};
@@ -181,7 +184,7 @@
   }
   template
   struct $Class[[C]] : $Namespace[[abc]]::$Class[[A]]<$TemplateParameter[[T]]> {
-typename $TemplateParameter[[T]]::A* $Field[[D]];
+typename $TemplateParameter[[T]]::$DependentType[[A]]* $Field[[D]];
   };
   $Namespace[[abc]]::$Class[[A]]<$Primitive[[int]]> $Variable[[AA]];
   typedef $Namespace[[abc]]::$Class[[A]]<$Primitive[[int]]> $Class[[AAA]];
@@ -529,6 +532,58 @@
   $Typedef[[Pointer]], $Typedef[[LVReference]], $Typedef[[RVReference]],
   $Typedef[[Array]], $Typedef[[MemberPointer]]);
   };
+)cpp",
+  R"cpp(
+  template 
+  $Primitive[[void]] $Function[[phase1]]($TemplateParameter[[T]]);
+  template 
+  $Primitive[[void]] $Function[[foo]]($TemplateParameter[[T]] $Parameter[[P]]) {
+$Function[[phase1]]($Parameter[[P]]);
+$DependentName[[phase2]]($Parameter[[P]]);
+  }
+)cpp",
+  R"cpp(
+  class $Class[[A]] {
+template 
+$Primitive[[void]] $Method[[bar]]($TemplateParameter[[T]]);
+  };
+
+  template 
+  $Primitive[[void]] $Function[[foo]]($TemplateParameter[[U]] $Parameter[[P]]) {
+$Class[[A]]().$Method[[bar]]($Parameter[[P]]);
+  }
+)cpp",
+  R"cpp(
+  struct $Class[[A]] {
+template 
+static $Primitive[[void]] $StaticMethod[[foo]]($TemplateParameter[[T]]);
+  };
+
+  template 
+  struct $Class[[B]] {
+$Primitive[[void]] $Method[[bar]]() {
+  $Class[[A]]::$StaticMethod[[foo]]($TemplateParameter[[T]]());
+}
+  };
+)cpp",
+  R"cpp(
+  template 
+  $Primitive[[void]] $Function[[foo]](typename $TemplateParameter[[T]]::$DependentType[[Type]]
+= $TemplateParameter[[T]]::$DependentName[[val]]);
+)cpp",
+  R"cpp(
+  template 
+  $Primitive[[void]] $Function[[foo]]($TemplateParameter[[T]] $Parameter[[P]]) {
+$Parameter[[P]].$DependentName[[Field]];
+  }
+)cpp",
+  R"cpp(
+  template 
+  class $Class[[A]] {
+$Primitive[[int]] $Method[[foo]]() {
+  return $TemplateParameter[[T]]::$DependentName[[Field]];
+}
+  };
 )cpp"};
   for (const auto  : TestCases) {
 checkHighlightings(TestCase);
Index: clang-tools-extra/clangd/test/semantic-highlighting.test
===
--- clang-tools-extra/clangd/test/semantic-highlighting.test
+++ clang-tools-extra/clangd/test/semantic-highlighting.test
@@ -41,6 +41,12 @@
 # CHECK-NEXT:"entity.name.type.typedef.cpp"
 # CHECK-NEXT:  ],
 # CHECK-NEXT:  [
+# CHECK-NEXT:"entity.name.type.dependent.cpp"
+# CHECK-NEXT:  ],
+# CHECK-NEXT:  [
+# CHECK-NEXT:"entity.name.other.dependent.cpp"
+# CHECK-NEXT:  ],
+# CHECK-NEXT:  [
 # CHECK-NEXT:"entity.name.namespace.cpp"
 # CHECK-NEXT:  ],
 # CHECK-NEXT:  [
@@ -61,7 +67,7 @@
 # CHECK-NEXT:"lines": [
 # CHECK-NEXT:  {
 # CHECK-NEXT:"line": 0,
-# CHECK-NEXT:"tokens": "AAADAA4EAAEAAA=="
+# CHECK-NEXT:"tokens": "AAADABAEAAEAAA=="
 # CHECK-NEXT:  }
 # CHECK-NEXT:],
 # CHECK-NEXT:"textDocument": {
@@ -76,11 +82,11 @@
 # CHECK-NEXT:"lines": [
 # CHECK-NEXT:  {
 # CHECK-NEXT:"line": 0,
-# CHECK-NEXT:"tokens": "AAADAA4EAAEAAA=="
+# CHECK-NEXT:"tokens": "AAADABAEAAEAAA=="
 # CHECK-NEXT:  }
 # CHECK-NEXT:  {
 # CHECK-NEXT:"line": 1,
-# 

[clang-tools-extra] r374799 - [clangd] Improve semantic highlighting in dependent contexts (fixes #154)

2019-10-14 Thread Nathan Ridge via cfe-commits
Author: nridge
Date: Mon Oct 14 11:26:13 2019
New Revision: 374799

URL: http://llvm.org/viewvc/llvm-project?rev=374799=rev
Log:
[clangd] Improve semantic highlighting in dependent contexts (fixes #154)

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, 
cfe-commits

Tags: #clang

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

Modified:
clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp
clang-tools-extra/trunk/clangd/SemanticHighlighting.h
clang-tools-extra/trunk/clangd/test/semantic-highlighting.test
clang-tools-extra/trunk/clangd/unittests/SemanticHighlightingTests.cpp

Modified: clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp?rev=374799=374798=374799=diff
==
--- clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp (original)
+++ clang-tools-extra/trunk/clangd/SemanticHighlighting.cpp Mon Oct 14 11:26:13 
2019
@@ -37,6 +37,10 @@ bool canHighlightName(DeclarationName Na
 
 llvm::Optional kindForType(const Type *TP);
 llvm::Optional kindForDecl(const NamedDecl *D) {
+  if (auto *TD = dyn_cast(D)) {
+if (auto *Templated = TD->getTemplatedDecl())
+  D = Templated;
+  }
   if (auto *TD = dyn_cast(D)) {
 // We try to highlight typedefs as their underlying type.
 if (auto K = kindForType(TD->getUnderlyingType().getTypePtrOrNull()))
@@ -95,6 +99,20 @@ llvm::Optional kindFor
 return kindForDecl(TD);
   return llvm::None;
 }
+// Given a set of candidate declarations for an unresolved name,
+// if the declarations all have the same highlighting kind, return
+// that highlighting kind, otherwise return None.
+llvm::Optional
+kindForCandidateDecls(llvm::iterator_range Decls) {
+  llvm::Optional Result;
+  for (NamedDecl *Decl : Decls) {
+auto Kind = kindForDecl(Decl);
+if (!Kind || (Result && Kind != Result))
+  return llvm::None;
+Result = Kind;
+  }
+  return Result;
+}
 
 // Collects all semantic tokens in an ASTContext.
 class HighlightingTokenCollector
@@ -152,6 +170,26 @@ public:
 return true;
   }
 
+  bool VisitOverloadExpr(OverloadExpr *E) {
+if (canHighlightName(E->getName()))
+  addToken(E->getNameLoc(),
+   kindForCandidateDecls(E->decls())
+   .getValueOr(HighlightingKind::DependentName));
+return true;
+  }
+
+  bool VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {
+if (canHighlightName(E->getDeclName()))
+  addToken(E->getLocation(), HighlightingKind::DependentName);
+return true;
+  }
+
+  bool VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E) {
+if (canHighlightName(E->getMember()))
+  addToken(E->getMemberLoc(), HighlightingKind::DependentName);
+return true;
+  }
+
   bool VisitNamedDecl(NamedDecl *ND) {
 if (canHighlightName(ND->getDeclName()))
   addToken(ND->getLocation(), ND);
@@ -187,6 +225,11 @@ public:
 return true;
   }
 
+  bool WalkUpFromDependentNameTypeLoc(DependentNameTypeLoc L) {
+addToken(L.getNameLoc(), HighlightingKind::DependentType);
+return true;
+  }
+
   bool VisitTypeLoc(TypeLoc TL) {
 if (auto K = kindForType(TL.getTypePtr()))
   addToken(TL.getBeginLoc(), *K);
@@ -339,6 +382,10 @@ llvm::raw_ostream <<(llvm::raw_
 return OS << "EnumConstant";
   case HighlightingKind::Typedef:
 return OS << "Typedef";
+  case HighlightingKind::DependentType:
+return OS << "DependentType";
+  case HighlightingKind::DependentName:
+return OS << "DependentName";
   case HighlightingKind::Namespace:
 return OS << "Namespace";
   case HighlightingKind::TemplateParameter:
@@ -468,6 +515,10 @@ llvm::StringRef toTextMateScope(Highligh
 return "variable.other.enummember.cpp";
   case HighlightingKind::Typedef:
 return "entity.name.type.typedef.cpp";
+  case HighlightingKind::DependentType:
+return "entity.name.type.dependent.cpp";
+  case HighlightingKind::DependentName:
+return "entity.name.other.dependent.cpp";
   case HighlightingKind::Namespace:
 return "entity.name.namespace.cpp";
   case HighlightingKind::TemplateParameter:

Modified: clang-tools-extra/trunk/clangd/SemanticHighlighting.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/SemanticHighlighting.h?rev=374799=374798=374799=diff
==
--- clang-tools-extra/trunk/clangd/SemanticHighlighting.h (original)
+++ clang-tools-extra/trunk/clangd/SemanticHighlighting.h Mon Oct 14 11:26:13 
2019
@@ -37,6 +37,8 @@ enum class HighlightingKind {
   Enum,
   EnumConstant,
   Typedef,
+  DependentType,
+  DependentName,
   Namespace,
   TemplateParameter,
   Primitive,

Modified: clang-tools-extra/trunk/clangd/test/semantic-highlighting.test
URL: 

[PATCH] D68915: [clang][IFS] Escape mangled name in-order to not break llvm-ifs with names mangled using MS ABI

2019-10-14 Thread Puyan Lotfi via Phabricator via cfe-commits
plotfi added a comment.

I see what went wrong. Will post a fix shortly.

In D68915#1708297 , @thakis wrote:

> On macOS symbols are prefixed with an underscore:
>
>   Command Output (stderr):
>   --
>   /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/object.c:5:16: 
> error: CHECK-TAPI: expected string not found in input
>   // CHECK-TAPI: "data" : { Type: Object, Size: 4 }
>  ^
>   :1:1: note: scanning from here
>   --- !experimental-ifs-v1
>   ^
>   :6:3: note: possible intended match here
>"_data" : { Type: Object, Size: 4 }
> ^
>  
>   --
>   
>   Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
>   Testing Time: 164.94s
>   
>   Failing Tests (1):
>   Clang :: InterfaceStubs/object.c``





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68915



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


[PATCH] D67901: [clangd] Improve semantic highlighting in dependent contexts (fixes #154)

2019-10-14 Thread Nathan Ridge via Phabricator via cfe-commits
nridge updated this revision to Diff 224880.
nridge marked 2 inline comments as done.
nridge added a comment.

Address last review comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67901

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp
  clang-tools-extra/clangd/SemanticHighlighting.h
  clang-tools-extra/clangd/test/semantic-highlighting.test
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp

Index: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
===
--- clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
+++ clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
@@ -51,6 +51,9 @@
   {HighlightingKind::StaticField, "StaticField"},
   {HighlightingKind::Method, "Method"},
   {HighlightingKind::StaticMethod, "StaticMethod"},
+  {HighlightingKind::Typedef, "Typedef"},
+  {HighlightingKind::DependentType, "DependentType"},
+  {HighlightingKind::DependentName, "DependentName"},
   {HighlightingKind::TemplateParameter, "TemplateParameter"},
   {HighlightingKind::Primitive, "Primitive"},
   {HighlightingKind::Macro, "Macro"}};
@@ -175,7 +178,7 @@
   }
   template
   struct $Class[[C]] : $Namespace[[abc]]::$Class[[A]]<$TemplateParameter[[T]]> {
-typename $TemplateParameter[[T]]::A* $Field[[D]];
+typename $TemplateParameter[[T]]::$DependentType[[A]]* $Field[[D]];
   };
   $Namespace[[abc]]::$Class[[A]]<$Primitive[[int]]> $Variable[[AA]];
   typedef $Namespace[[abc]]::$Class[[A]]<$Primitive[[int]]> $Class[[AAA]];
@@ -523,6 +526,58 @@
   $Typedef[[Pointer]], $Typedef[[LVReference]], $Typedef[[RVReference]],
   $Typedef[[Array]], $Typedef[[MemberPointer]]);
   };
+)cpp",
+  R"cpp(
+  template 
+  $Primitive[[void]] $Function[[phase1]]($TemplateParameter[[T]]);
+  template 
+  $Primitive[[void]] $Function[[foo]]($TemplateParameter[[T]] $Parameter[[P]]) {
+$Function[[phase1]]($Parameter[[P]]);
+$DependentName[[phase2]]($Parameter[[P]]);
+  }
+)cpp",
+  R"cpp(
+  class $Class[[A]] {
+template 
+$Primitive[[void]] $Method[[bar]]($TemplateParameter[[T]]);
+  };
+
+  template 
+  $Primitive[[void]] $Function[[foo]]($TemplateParameter[[U]] $Parameter[[P]]) {
+$Class[[A]]().$Method[[bar]]($Parameter[[P]]);
+  }
+)cpp",
+  R"cpp(
+  struct $Class[[A]] {
+template 
+static $Primitive[[void]] $StaticMethod[[foo]]($TemplateParameter[[T]]);
+  };
+
+  template 
+  struct $Class[[B]] {
+$Primitive[[void]] $Method[[bar]]() {
+  $Class[[A]]::$StaticMethod[[foo]]($TemplateParameter[[T]]());
+}
+  };
+)cpp",
+  R"cpp(
+  template 
+  $Primitive[[void]] $Function[[foo]](typename $TemplateParameter[[T]]::$DependentType[[Type]]
+= $TemplateParameter[[T]]::$DependentName[[val]]);
+)cpp",
+  R"cpp(
+  template 
+  $Primitive[[void]] $Function[[foo]]($TemplateParameter[[T]] $Parameter[[P]]) {
+$Parameter[[P]].$DependentName[[Field]];
+  }
+)cpp",
+  R"cpp(
+  template 
+  class $Class[[A]] {
+$Primitive[[int]] $Method[[foo]]() {
+  return $TemplateParameter[[T]]::$DependentName[[Field]];
+}
+  };
 )cpp"};
   for (const auto  : TestCases) {
 checkHighlightings(TestCase);
Index: clang-tools-extra/clangd/test/semantic-highlighting.test
===
--- clang-tools-extra/clangd/test/semantic-highlighting.test
+++ clang-tools-extra/clangd/test/semantic-highlighting.test
@@ -41,6 +41,12 @@
 # CHECK-NEXT:"entity.name.type.typedef.cpp"
 # CHECK-NEXT:  ],
 # CHECK-NEXT:  [
+# CHECK-NEXT:"entity.name.type.dependent.cpp"
+# CHECK-NEXT:  ],
+# CHECK-NEXT:  [
+# CHECK-NEXT:"entity.name.other.dependent.cpp"
+# CHECK-NEXT:  ],
+# CHECK-NEXT:  [
 # CHECK-NEXT:"entity.name.namespace.cpp"
 # CHECK-NEXT:  ],
 # CHECK-NEXT:  [
@@ -61,7 +67,7 @@
 # CHECK-NEXT:"lines": [
 # CHECK-NEXT:  {
 # CHECK-NEXT:"line": 0,
-# CHECK-NEXT:"tokens": "AAADAA4EAAEAAA=="
+# CHECK-NEXT:"tokens": "AAADABAEAAEAAA=="
 # CHECK-NEXT:  }
 # CHECK-NEXT:],
 # CHECK-NEXT:"textDocument": {
@@ -76,11 +82,11 @@
 # CHECK-NEXT:"lines": [
 # CHECK-NEXT:  {
 # CHECK-NEXT:"line": 0,
-# CHECK-NEXT:"tokens": "AAADAA4EAAEAAA=="
+# CHECK-NEXT:"tokens": "AAADABAEAAEAAA=="
 # CHECK-NEXT:  }
 # CHECK-NEXT:  {
 # CHECK-NEXT:"line": 1,
-# CHECK-NEXT:"tokens": "AAADAA4EAAEAAA=="
+# 

[PATCH] D68915: [clang][IFS] Escape mangled name in-order to not break llvm-ifs with names mangled using MS ABI

2019-10-14 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

On macOS symbols are prefixed with an underscore:

  Command Output (stderr):
  --
  /Users/thakis/src/llvm-project/clang/test/InterfaceStubs/object.c:5:16: 
error: CHECK-TAPI: expected string not found in input
  // CHECK-TAPI: "data" : { Type: Object, Size: 4 }
 ^
  :1:1: note: scanning from here
  --- !experimental-ifs-v1
  ^
  :6:3: note: possible intended match here
   "_data" : { Type: Object, Size: 4 }
^
  
  --
  
  Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
  Testing Time: 164.94s
  
  Failing Tests (1):
  Clang :: InterfaceStubs/object.c``


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68915



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


[PATCH] D61675: [WIP] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator

2019-10-14 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added a comment.

Fix incoming. Sorry for not running the ASan tests...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61675



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


[PATCH] D68947: [libc++][test] Add license headers to test/support/archetypes.*

2019-10-14 Thread Casey Carter via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc86ba5818833: [libc++][test] Add license headers to 
test/support/archetypes.* (authored by CaseyCarter).
Herald added subscribers: libcxx-commits, christof.
Herald added a project: libc++.

Changed prior to commit:
  https://reviews.llvm.org/D68947?vs=224867=224878#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68947

Files:
  libcxx/test/support/archetypes.h
  libcxx/test/support/archetypes.ipp


Index: libcxx/test/support/archetypes.ipp
===
--- libcxx/test/support/archetypes.ipp
+++ libcxx/test/support/archetypes.ipp
@@ -1,3 +1,10 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
 
 #ifndef DEFINE_BASE
 #define DEFINE_BASE(Name) ::ArchetypeBases::NullBase
Index: libcxx/test/support/archetypes.h
===
--- libcxx/test/support/archetypes.h
+++ libcxx/test/support/archetypes.h
@@ -1,3 +1,11 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
 #ifndef TEST_SUPPORT_ARCHETYPES_H
 #define TEST_SUPPORT_ARCHETYPES_H
 


Index: libcxx/test/support/archetypes.ipp
===
--- libcxx/test/support/archetypes.ipp
+++ libcxx/test/support/archetypes.ipp
@@ -1,3 +1,10 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
 
 #ifndef DEFINE_BASE
 #define DEFINE_BASE(Name) ::ArchetypeBases::NullBase
Index: libcxx/test/support/archetypes.h
===
--- libcxx/test/support/archetypes.h
+++ libcxx/test/support/archetypes.h
@@ -1,3 +1,11 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
 #ifndef TEST_SUPPORT_ARCHETYPES_H
 #define TEST_SUPPORT_ARCHETYPES_H
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68915: [clang][IFS] Escape mangled name in-order to not break llvm-ifs with names mangled using MS ABI

2019-10-14 Thread Puyan Lotfi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG76f9869bf200: [clang][IFS] Escape mangled names so  MS ABI 
doesnt break YAML parsing. (authored by plotfi).

Changed prior to commit:
  https://reviews.llvm.org/D68915?vs=224756=224879#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68915

Files:
  clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
  clang/test/InterfaceStubs/inline.c
  clang/test/InterfaceStubs/object.c
  clang/test/InterfaceStubs/windows.cpp


Index: clang/test/InterfaceStubs/windows.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/windows.cpp
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang -target x86_64-windows-msvc -o - %s \
+// RUN: -emit-interface-stubs -emit-merged-ifs | FileCheck %s
+
+// CHECK: Symbols:
+// CHECK-NEXT: ?helloWindowsMsvc@@YAHXZ
+int helloWindowsMsvc();
Index: clang/test/InterfaceStubs/object.c
===
--- clang/test/InterfaceStubs/object.c
+++ clang/test/InterfaceStubs/object.c
@@ -2,6 +2,6 @@
 // RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | 
FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI: data: { Type: Object, Size: 4 }
+// CHECK-TAPI: "data" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data
 int data = 42;
Index: clang/test/InterfaceStubs/inline.c
===
--- clang/test/InterfaceStubs/inline.c
+++ clang/test/InterfaceStubs/inline.c
@@ -56,8 +56,8 @@
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI-DAG: foo: { Type: Func }
-// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
+// CHECK-TAPI-DAG: "foo" : { Type: Func }
+// CHECK-TAPI-DAG: "foo.var" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS-DAG: foo
 // CHECK-SYMBOLS-DAG: foo.var
 #include "inline.h"
Index: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
===
--- clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -263,11 +263,11 @@
   for (const auto  : Symbols) {
 const MangledSymbol  = E.second;
 for (auto Name : Symbol.Names) {
-  OS << "  "
+  OS << "  \""
  << (Symbol.ParentName.empty() || Instance.getLangOpts().CPlusPlus
  ? ""
  : (Symbol.ParentName + "."))
- << Name << ": { Type: ";
+ << Name << "\" : { Type: ";
   switch (Symbol.Type) {
   default:
 llvm_unreachable(


Index: clang/test/InterfaceStubs/windows.cpp
===
--- /dev/null
+++ clang/test/InterfaceStubs/windows.cpp
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang -target x86_64-windows-msvc -o - %s \
+// RUN: -emit-interface-stubs -emit-merged-ifs | FileCheck %s
+
+// CHECK: Symbols:
+// CHECK-NEXT: ?helloWindowsMsvc@@YAHXZ
+int helloWindowsMsvc();
Index: clang/test/InterfaceStubs/object.c
===
--- clang/test/InterfaceStubs/object.c
+++ clang/test/InterfaceStubs/object.c
@@ -2,6 +2,6 @@
 // RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI: data: { Type: Object, Size: 4 }
+// CHECK-TAPI: "data" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data
 int data = 42;
Index: clang/test/InterfaceStubs/inline.c
===
--- clang/test/InterfaceStubs/inline.c
+++ clang/test/InterfaceStubs/inline.c
@@ -56,8 +56,8 @@
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI-DAG: foo: { Type: Func }
-// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
+// CHECK-TAPI-DAG: "foo" : { Type: Func }
+// CHECK-TAPI-DAG: "foo.var" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS-DAG: foo
 // CHECK-SYMBOLS-DAG: foo.var
 #include "inline.h"
Index: clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
===
--- clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
+++ clang/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
@@ -263,11 +263,11 @@
   for (const auto  : Symbols) {
 const MangledSymbol  = E.second;
 for (auto Name : Symbol.Names) {
-  OS << "  "
+  OS << "  \""
  << (Symbol.ParentName.empty() || 

r374798 - [clang][IFS] Escape mangled names so MS ABI doesn't break YAML parsing.

2019-10-14 Thread Puyan Lotfi via cfe-commits
Author: zer0
Date: Mon Oct 14 11:03:03 2019
New Revision: 374798

URL: http://llvm.org/viewvc/llvm-project?rev=374798=rev
Log:
[clang][IFS] Escape mangled names so  MS ABI doesn't break YAML parsing.

Microsoft's ABI mangles names differently than Itanium and this breaks the LLVM
yaml parser unless the name is escaped in quotes. Quotes are being added to the
mangled names of the IFS file generation so that llvm-ifs doesn't break when
Windows triples are passed to the driver.

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

Added:
cfe/trunk/test/InterfaceStubs/windows.cpp
Modified:
cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
cfe/trunk/test/InterfaceStubs/inline.c
cfe/trunk/test/InterfaceStubs/object.c

Modified: cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp?rev=374798=374797=374798=diff
==
--- cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/InterfaceStubFunctionsConsumer.cpp Mon Oct 14 
11:03:03 2019
@@ -263,11 +263,11 @@ public:
   for (const auto  : Symbols) {
 const MangledSymbol  = E.second;
 for (auto Name : Symbol.Names) {
-  OS << "  "
+  OS << "  \""
  << (Symbol.ParentName.empty() || Instance.getLangOpts().CPlusPlus
  ? ""
  : (Symbol.ParentName + "."))
- << Name << ": { Type: ";
+ << Name << "\" : { Type: ";
   switch (Symbol.Type) {
   default:
 llvm_unreachable(

Modified: cfe/trunk/test/InterfaceStubs/inline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/inline.c?rev=374798=374797=374798=diff
==
--- cfe/trunk/test/InterfaceStubs/inline.c (original)
+++ cfe/trunk/test/InterfaceStubs/inline.c Mon Oct 14 11:03:03 2019
@@ -56,8 +56,8 @@ INLINE int foo() {
 // RUN: -c -std=gnu89 -xc %s | llvm-nm - 2>&1 | \
 // RUN: FileCheck -check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI-DAG: foo: { Type: Func }
-// CHECK-TAPI-DAG: foo.var: { Type: Object, Size: 4 }
+// CHECK-TAPI-DAG: "foo" : { Type: Func }
+// CHECK-TAPI-DAG: "foo.var" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS-DAG: foo
 // CHECK-SYMBOLS-DAG: foo.var
 #include "inline.h"

Modified: cfe/trunk/test/InterfaceStubs/object.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/object.c?rev=374798=374797=374798=diff
==
--- cfe/trunk/test/InterfaceStubs/object.c (original)
+++ cfe/trunk/test/InterfaceStubs/object.c Mon Oct 14 11:03:03 2019
@@ -2,6 +2,6 @@
 // RUN: %clang -fvisibility=default -c -o - -emit-interface-stubs %s | 
FileCheck -check-prefix=CHECK-SYMBOLS %s
 // RUN: %clang -fvisibility=default -c -o - %s | llvm-nm - 2>&1 | FileCheck 
-check-prefix=CHECK-SYMBOLS %s
 
-// CHECK-TAPI: data: { Type: Object, Size: 4 }
+// CHECK-TAPI: "data" : { Type: Object, Size: 4 }
 // CHECK-SYMBOLS: data
 int data = 42;

Added: cfe/trunk/test/InterfaceStubs/windows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/InterfaceStubs/windows.cpp?rev=374798=auto
==
--- cfe/trunk/test/InterfaceStubs/windows.cpp (added)
+++ cfe/trunk/test/InterfaceStubs/windows.cpp Mon Oct 14 11:03:03 2019
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang -target x86_64-windows-msvc -o - %s \
+// RUN: -emit-interface-stubs -emit-merged-ifs | FileCheck %s
+
+// CHECK: Symbols:
+// CHECK-NEXT: ?helloWindowsMsvc@@YAHXZ
+int helloWindowsMsvc();


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


[PATCH] D61675: [WIP] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator

2019-10-14 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added a comment.

Apologies, @pcc. Looking now. Will revert if it's not obvious...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61675



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


[PATCH] D67508: [RISCV] support mutilib in baremetal environment

2019-10-14 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

Please can you rebase these changes? Something has changed in 
RISCVToolchain.cpp and they are failing to build.

Q: Is there a plan to support multilib aliases (`MULTILIB_REUSE`)? I'm happy 
for this to be in a follow-up patch, would just like to know the plan.




Comment at: clang/lib/Driver/ToolChains/Gnu.cpp:1521
+  {"rv32i", "ilp32"},{"rv32im", "ilp32"}, {"rv32iac", "ilp32"},
+  {"rv32imac", "ilp32"}, {"rv32imafc", "ilp32f"}, {"rv64i", "lp64"},
+  {"rv64imac", "lp64"},  {"rv64imafdc", "lp64d"}};

I cannot see `march=rv64i/mabi=lp64` in [[ 
https://github.com/riscv/riscv-gcc/blob/ed3f6ec/gcc/config/riscv/t-elf-multilib 
| riscv-gcc t-elf-multilib ]] (the given sha is pulled from `.gitmodules` in 
riscv-gcc-toolchain. 


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

https://reviews.llvm.org/D67508



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


[PATCH] D61675: [WIP] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator

2019-10-14 Thread Peter Collingbourne via Phabricator via cfe-commits
pcc added a comment.

Hi, it looks like this patch has caused a test failure under asan:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/35922/steps/check-llvm%20asan/logs/stdio
Can you please take a look?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61675



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


[PATCH] D68528: [Implicit Modules] Add -cc1 option -fmodules-strict-hash which includes search paths and diagnostics.

2019-10-14 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Hi Michael, thanks for working on this!




Comment at: include/clang/Lex/HeaderSearchOptions.h:206
 
+  /// Weather we should include all things that could impact the module in the
+  /// hash.

*whether



Comment at: include/clang/Lex/HeaderSearchOptions.h:209
+  ///
+  /// This includes things like the full header search path.
+  unsigned ModulesStrictHash : 1;

What else do you plan to add in the future as part of "all the things that 
could impact"? It seems to me that by default this should always be the case, 
but header search related things are special because one might want to  
handwave on correctness to have smaller caches (default behavior right now). 

I wonder if we should instead have `fmodules-strict-header-seach` and later on 
add a more generic thing that group such cases? WDYT?


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

https://reviews.llvm.org/D68528



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


r374787 - [OPENMP]Fix codegen for private variably length vars in combined

2019-10-14 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Mon Oct 14 09:44:01 2019
New Revision: 374787

URL: http://llvm.org/viewvc/llvm-project?rev=374787=rev
Log:
[OPENMP]Fix codegen for private variably length vars in combined
constructs.

If OpenMP construct includes several capturing regions and the variable
is declared as private, the length of the inner variable length array is
not captured in outer captured regions, only in the innermost region.
Patch fixes this bug.

Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/target_teams_codegen.cpp

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=374787=374786=374787=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Oct 14 09:44:01 2019
@@ -9067,6 +9067,10 @@ private:
   void adjustOpenMPTargetScopeIndex(unsigned ,
 unsigned Level) const;
 
+  /// Returns the number of scopes associated with the construct on the given
+  /// OpenMP level.
+  int getNumberOfConstructScopes(unsigned Level) const;
+
   /// Push new OpenMP function region for non-capturing function.
   void pushOpenMPFunctionRegion();
 

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=374787=374786=374787=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Oct 14 09:44:01 2019
@@ -16092,7 +16092,25 @@ bool Sema::tryCaptureVariable(
 // target region should not be captured outside the scope of the 
region.
 if (RSI->CapRegionKind == CR_OpenMP) {
   bool IsOpenMPPrivateDecl = isOpenMPPrivateDecl(Var, 
RSI->OpenMPLevel);
-  auto IsTargetCap = !IsOpenMPPrivateDecl &&
+  // If the variable is private (i.e. not captured) and has variably
+  // modified type, we still need to capture the type for correct
+  // codegen in all regions, associated with the construct. Currently,
+  // it is captured in the innermost captured region only.
+  if (IsOpenMPPrivateDecl && Var->getType()->isVariablyModifiedType()) 
{
+QualType QTy = Var->getType();
+if (ParmVarDecl *PVD = dyn_cast_or_null(Var))
+  QTy = PVD->getOriginalType();
+for (int I = 1, E = getNumberOfConstructScopes(RSI->OpenMPLevel);
+ I < E; ++I) {
+  auto *OuterRSI = cast(
+  FunctionScopes[FunctionScopesIndex - I]);
+  assert(RSI->OpenMPLevel == OuterRSI->OpenMPLevel &&
+ "Wrong number of captured regions associated with the "
+ "OpenMP construct.");
+  captureVariablyModifiedType(Context, QTy, OuterRSI);
+}
+  }
+  bool IsTargetCap = !IsOpenMPPrivateDecl &&
  isOpenMPTargetCapturedDecl(Var, RSI->OpenMPLevel);
   // When we detect target captures we are looking from inside the
   // target region, therefore we need to propagate the capture from the

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=374787=374786=374787=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Oct 14 09:44:01 2019
@@ -3435,6 +3435,10 @@ void Sema::ActOnOpenMPRegionStart(OpenMP
   }
 }
 
+int Sema::getNumberOfConstructScopes(unsigned Level) const {
+  return getOpenMPCaptureLevels(DSAStack->getDirective(Level));
+}
+
 int Sema::getOpenMPCaptureLevels(OpenMPDirectiveKind DKind) {
   SmallVector CaptureRegions;
   getOpenMPCaptureRegions(CaptureRegions, DKind);

Modified: cfe/trunk/test/OpenMP/target_teams_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_teams_codegen.cpp?rev=374787=374786=374787=diff
==
--- cfe/trunk/test/OpenMP/target_teams_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_teams_codegen.cpp Mon Oct 14 09:44:01 2019
@@ -86,6 +86,7 @@
 // TCHECK: @{{.+}} = weak constant [[ENTTY]]
 // TCHECK: @{{.+}} = weak constant [[ENTTY]]
 // TCHECK: @{{.+}} = weak constant [[ENTTY]]
+// TCHECK: @{{.+}} = weak constant [[ENTTY]]
 // TCHECK-NOT: @{{.+}} = weak constant [[ENTTY]]
 
 // Check if offloading descriptor is created.
@@ -341,6 +342,13 @@ int foo(int n) {
 d.Y += 1;
   }
 
+  const int nn = 0;
+  #pragma omp target teams shared(nn)
+  #pragma omp parallel firstprivate(nn)
+  (void)nn;
+  #pragma omp target teams firstprivate(nn)
+  #pragma omp parallel shared(nn)
+  

[PATCH] D67185: [RISCV] Add support for -ffixed-xX flags

2019-10-14 Thread Alex Bradbury via Phabricator via cfe-commits
asb added a comment.

In D67185#1707849 , @lenary wrote:

> Note, D68862  is in-progress at the moment, 
> which is related to this patch.


Indeed - Simon, could you please go through that patch and ensure that the 
implementation here is aligned to it (or indeed, feed back on that patch if you 
feel they should be doing something differently). Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67185



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


[PATCH] D67608: [ARM] Preserve fpu behaviour for '-crypto'

2019-10-14 Thread Diogo N. Sampaio via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2cb43b45713d: [ARM] Preserve fpu behaviour for 
-crypto (authored by dnsampaio).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67608

Files:
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/test/Driver/arm-features.c


Index: clang/test/Driver/arm-features.c
===
--- clang/test/Driver/arm-features.c
+++ clang/test/Driver/arm-features.c
@@ -79,3 +79,18 @@
 // RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-m23+crypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO5 %s
 // CHECK-NOCRYPTO5: warning: ignoring extension 'crypto' because the {{.*}} 
architecture does not support it
 // CHECK-NOCRYPTO5-NOT: "-target-feature" "+crypto"{{.*}} "-target-feature" 
"+sha2" "-target-feature" "+aes"
+//
+// Check +crypto does not affect -march=armv7a -mfpu=crypto-neon-fp-armv8, but 
it does warn that +crypto has no effect
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as -march=armv7a 
-mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=CHECK-WARNONLY,ALL %s
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as -march=armv7a+aes 
-mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=CHECK-WARNONLY,ALL,CHECK-HASAES %s
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as 
-march=armv7a+sha2 -mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=CHECK-WARNONLY,ALL,CHECK-HASSHA %s
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as 
-march=armv7a+sha2+aes -mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=CHECK-WARNONLY,ALL,CHECK-HASSHA,CHECK-HASAES %s
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as -march=armv7a+aes 
-mfpu=neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=ALL,CHECK-HASAES %s
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as 
-march=armv7a+sha2 -mfpu=neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=ALL,CHECK-HASSHA %s
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as 
-march=armv7a+sha2+aes -mfpu=neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=ALL,CHECK-HASSHA,CHECK-HASAES %s
+// CHECK-WARNONLY: warning: ignoring extension 'crypto' because the 'armv7-a' 
architecture does not support it
+// ALL: "-target-feature"
+// CHECK-WARNONLY-NOT: "-target-feature" "-crypto"
+// CHECK-HASSHA-SAME:  "-target-feature" "+sha2"
+// CHECK-HASAES-SAME:  "-target-feature" "+aes"
+//
Index: clang/lib/Driver/ToolChains/Arch/ARM.cpp
===
--- clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -479,24 +479,33 @@
 
   // For Arch >= ARMv8.0 && A profile:  crypto = sha2 + aes
   // FIXME: this needs reimplementation after the TargetParser rewrite
-  auto CryptoIt =
-llvm::find_if(llvm::reverse(Features),
-  [](const StringRef F) { return F.contains("crypto"); });
-  if (CryptoIt != Features.rend() && CryptoIt->take_front() == "+") {
-StringRef ArchSuffix = arm::getLLVMArchSuffixForARM(
-arm::getARMTargetCPU(CPUName, ArchName, Triple), ArchName, Triple);
-if (llvm::ARM::parseArchVersion(ArchSuffix) >= 8 &&
-llvm::ARM::parseArchProfile(ArchSuffix) == llvm::ARM::ProfileKind::A) {
-  if (ArchName.find_lower("+nosha2") == StringRef::npos &&
-  CPUName.find_lower("+nosha2") == StringRef::npos)
-Features.push_back("+sha2");
-  if (ArchName.find_lower("+noaes") == StringRef::npos &&
-  CPUName.find_lower("+noaes") == StringRef::npos)
-Features.push_back("+aes");
-} else {
-  D.Diag(clang::diag::warn_target_unsupported_extension)
-<< "crypto" << 
llvm::ARM::getArchName(llvm::ARM::parseArch(ArchSuffix));
-  Features.push_back("-crypto");
+  auto CryptoIt = llvm::find_if(llvm::reverse(Features), [](const StringRef F) 
{
+return F.contains("crypto");
+  });
+  if (CryptoIt != Features.rend()) {
+if (CryptoIt->take_front() == "+") {
+  StringRef ArchSuffix = arm::getLLVMArchSuffixForARM(
+  arm::getARMTargetCPU(CPUName, ArchName, Triple), ArchName, Triple);
+  if (llvm::ARM::parseArchVersion(ArchSuffix) >= 8 &&
+  llvm::ARM::parseArchProfile(ArchSuffix) ==
+  llvm::ARM::ProfileKind::A) {
+if (ArchName.find_lower("+nosha2") == StringRef::npos &&
+CPUName.find_lower("+nosha2") == StringRef::npos)
+  Features.push_back("+sha2");
+if (ArchName.find_lower("+noaes") == StringRef::npos &&
+CPUName.find_lower("+noaes") == StringRef::npos)
+  Features.push_back("+aes");
+  } else {
+D.Diag(clang::diag::warn_target_unsupported_extension)
+<< "crypto"
+<< 

r374785 - [ARM] Preserve fpu behaviour for '-crypto'

2019-10-14 Thread Diogo N. Sampaio via cfe-commits
Author: dnsampaio
Date: Mon Oct 14 09:29:26 2019
New Revision: 374785

URL: http://llvm.org/viewvc/llvm-project?rev=374785=rev
Log:
[ARM] Preserve fpu behaviour for '-crypto'

Summary:
This patch restores the behaviour that -fpu overwrites the
architecture obtained from -march or -mcpu flags, not enforcing to
disable 'crypto' if march=armv7 and mfpu=neon-fp-armv8.
However, it does warn that 'crypto' is ignored when passing
mfpu=crypto-neon-fp-armv8.

Reviewers: peter.smith, labrinea

Reviewed By: peter.smith

Subscribers: nickdesaulniers, kristof.beyls, dmgreen, cfe-commits, krisb

Tags: #clang

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

Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
cfe/trunk/test/Driver/arm-features.c

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp?rev=374785=374784=374785=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/ARM.cpp Mon Oct 14 09:29:26 2019
@@ -479,24 +479,33 @@ fp16_fml_fallthrough:
 
   // For Arch >= ARMv8.0 && A profile:  crypto = sha2 + aes
   // FIXME: this needs reimplementation after the TargetParser rewrite
-  auto CryptoIt =
-llvm::find_if(llvm::reverse(Features),
-  [](const StringRef F) { return F.contains("crypto"); });
-  if (CryptoIt != Features.rend() && CryptoIt->take_front() == "+") {
-StringRef ArchSuffix = arm::getLLVMArchSuffixForARM(
-arm::getARMTargetCPU(CPUName, ArchName, Triple), ArchName, Triple);
-if (llvm::ARM::parseArchVersion(ArchSuffix) >= 8 &&
-llvm::ARM::parseArchProfile(ArchSuffix) == llvm::ARM::ProfileKind::A) {
-  if (ArchName.find_lower("+nosha2") == StringRef::npos &&
-  CPUName.find_lower("+nosha2") == StringRef::npos)
-Features.push_back("+sha2");
-  if (ArchName.find_lower("+noaes") == StringRef::npos &&
-  CPUName.find_lower("+noaes") == StringRef::npos)
-Features.push_back("+aes");
-} else {
-  D.Diag(clang::diag::warn_target_unsupported_extension)
-<< "crypto" << 
llvm::ARM::getArchName(llvm::ARM::parseArch(ArchSuffix));
-  Features.push_back("-crypto");
+  auto CryptoIt = llvm::find_if(llvm::reverse(Features), [](const StringRef F) 
{
+return F.contains("crypto");
+  });
+  if (CryptoIt != Features.rend()) {
+if (CryptoIt->take_front() == "+") {
+  StringRef ArchSuffix = arm::getLLVMArchSuffixForARM(
+  arm::getARMTargetCPU(CPUName, ArchName, Triple), ArchName, Triple);
+  if (llvm::ARM::parseArchVersion(ArchSuffix) >= 8 &&
+  llvm::ARM::parseArchProfile(ArchSuffix) ==
+  llvm::ARM::ProfileKind::A) {
+if (ArchName.find_lower("+nosha2") == StringRef::npos &&
+CPUName.find_lower("+nosha2") == StringRef::npos)
+  Features.push_back("+sha2");
+if (ArchName.find_lower("+noaes") == StringRef::npos &&
+CPUName.find_lower("+noaes") == StringRef::npos)
+  Features.push_back("+aes");
+  } else {
+D.Diag(clang::diag::warn_target_unsupported_extension)
+<< "crypto"
+<< llvm::ARM::getArchName(llvm::ARM::parseArch(ArchSuffix));
+// With -fno-integrated-as -mfpu=crypto-neon-fp-armv8 some assemblers 
such as the GNU assembler
+// will permit the use of crypto instructions as the fpu will override 
the architecture.
+// We keep the crypto feature in this case to preserve compatibility.
+// In all other cases we remove the crypto feature.
+if (!Args.hasArg(options::OPT_fno_integrated_as))
+  Features.push_back("-crypto");
+  }
 }
   }
 

Modified: cfe/trunk/test/Driver/arm-features.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-features.c?rev=374785=374784=374785=diff
==
--- cfe/trunk/test/Driver/arm-features.c (original)
+++ cfe/trunk/test/Driver/arm-features.c Mon Oct 14 09:29:26 2019
@@ -79,3 +79,18 @@
 // RUN: %clang -target arm-arm-none-eabi -mcpu=cortex-m23+crypto -### -c %s 
2>&1 | FileCheck -check-prefix=CHECK-NOCRYPTO5 %s
 // CHECK-NOCRYPTO5: warning: ignoring extension 'crypto' because the {{.*}} 
architecture does not support it
 // CHECK-NOCRYPTO5-NOT: "-target-feature" "+crypto"{{.*}} "-target-feature" 
"+sha2" "-target-feature" "+aes"
+//
+// Check +crypto does not affect -march=armv7a -mfpu=crypto-neon-fp-armv8, but 
it does warn that +crypto has no effect
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as -march=armv7a 
-mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 
-check-prefixes=CHECK-WARNONLY,ALL %s
+// RUN: %clang -target arm-none-none-eabi -fno-integrated-as -march=armv7a+aes 
-mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck 

[PATCH] D68947: [libc++][test] Add license headers to test/support/archetypes.*

2019-10-14 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter created this revision.
CaseyCarter added reviewers: mclow.lists, EricWF, ldionne.
Herald added a subscriber: dexonsmith.

These two files (`archetypes.h` and `archetypes.ipp`) are missing license 
headers.


https://reviews.llvm.org/D68947

Files:
  test/support/archetypes.h
  test/support/archetypes.ipp


Index: test/support/archetypes.ipp
===
--- test/support/archetypes.ipp
+++ test/support/archetypes.ipp
@@ -1,3 +1,10 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
 
 #ifndef DEFINE_BASE
 #define DEFINE_BASE(Name) ::ArchetypeBases::NullBase
Index: test/support/archetypes.h
===
--- test/support/archetypes.h
+++ test/support/archetypes.h
@@ -1,3 +1,11 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
 #ifndef TEST_SUPPORT_ARCHETYPES_H
 #define TEST_SUPPORT_ARCHETYPES_H
 


Index: test/support/archetypes.ipp
===
--- test/support/archetypes.ipp
+++ test/support/archetypes.ipp
@@ -1,3 +1,10 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
 
 #ifndef DEFINE_BASE
 #define DEFINE_BASE(Name) ::ArchetypeBases::NullBase
Index: test/support/archetypes.h
===
--- test/support/archetypes.h
+++ test/support/archetypes.h
@@ -1,3 +1,11 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
 #ifndef TEST_SUPPORT_ARCHETYPES_H
 #define TEST_SUPPORT_ARCHETYPES_H
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D68862: [ARM] Allocatable Global Register Variables for ARM

2019-10-14 Thread Momchil Velikov via Phabricator via cfe-commits
chill added a comment.

In D68862#1708079 , @carwil wrote:

> > IMHO, since reserved registes are per-function, this strongly suggests 
> > implementation as function attribute(s), rather than subtarget features 
> > (also for the pre-existing r9).
>
> What do you mean reserved registers are per-function? That sounds like you're 
> describing local register variables, which I don't believe Clang has any 
> support for (and there aren't a great deal of use-cases for anyway).
>  We're specifically talking about global usage here.


I mean that the set is dynamically computed and depends on the specific 
function: cf. 
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp#L184
as opposed to, say, depend only on target/subtarget/abi.


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

https://reviews.llvm.org/D68862



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


[PATCH] D68117: [DWARF-5] Support for C++11 defaulted, deleted member functions.

2019-10-14 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D68117#1708114 , @SouraVX wrote:

> In D68117#1707680 , @dblaikie wrote:
>
> > In D68117#1707578 , @SouraVX wrote:
> >
> > > In D68117#1702595 , @probinson 
> > > wrote:
> > >
> > > > We really do want to pack the four mutually exclusive cases into two 
> > > > bits.  I have tried to give more explicit comments inline to explain 
> > > > how you would do this.  It really should work fine, recognizing that 
> > > > the "not defaulted" case is not explicitly represented in the textual 
> > > > IR because it uses a zero value in the defaulted/deleted subfield of 
> > > > SPFlags.
> > >
> > >
> > > Thanks Paul, for suggesting this. Your approach works fine. But as I was 
> > > working on some lvm-dwarfdump test cases. We seems to miss one corner 
> > > case --
> > >  Consider this test case;
> > >  class foo{
> > >
> > >   foo() = default;
> > >   ~foo() = default;
> > >void not_special() {}
> > >
> > > };
> > >  void not_a_member_of_foo(){}
> > >
> > > Now I'm getting DW_AT_defaulted getting emitted with value 
> > > DW_DEFAULTED_no, for functions "not_special" and "not_a_member_of_foo". 
> > > This behavior is undesirable since, DW_AT_defaulted attributes is only 
> > > valid for C++ special member functions{Constructors/Destructors, ...}.
> > >
> > > Please correct me if I'm wrong -- Now This attributes to- implicitly 
> > > defined "0" NotDefaulted bit.  which is getting checked{that's fine as 
> > > long as we have a dedicated bits for distinguishing} and true for every 
> > > subprogram or function in a CU.
> > >  void DwarfUnit::applySubprogramAttributes( ...
> > >  ...
> > >  else if (SP->isNotDefaulted())
> > >
> > >   addUInt(SPDie, dwarf::DW_AT_defaulted, dwarf::DW_FORM_data1,
> > >   dwarf::DW_DEFAULTED_no);
> > >
> > > ...
> >
> >
> > Perhaps we should only emit DEFAULTED_yes, and assume anything that's not 
> > DEFAULTED_yes, is... not defaulted?
> >
> > Also: What features is anyone planning to build with this information? I'm 
> > sort of inclined not to implement features without some use-case in 
> > mind/planned.
>
>
> Hi David, thanks for your suggestion. But, if we do that way, we may not be 
> able to capture it's location and, whether that function was defaulted in or 
> out of class.


Not sure I follow - for an out-of-class defaulting, I'd expect the non-defining 
(declaration) DW_TAG_subprogram inside the class to not have the 
DW_AT_defaulted attribute - and then the out of line definition would have 
DW_AT_defaulted = DEFAULTED_yes. For an inline defaulted definition, the 
non-defining DW_TAG_subprogram would have DW_AT_defaulted= DEFAULTED_yes, and 
the defining DW_TAG_subprogram would have no DW_AT_defaulted, it would inherit 
it from the declaration via DW_AT_specification.

> Regarding the intent behind doing this, we have an initial internal 
> requirement for 100% compliance towards DWARF-5 from producer{Clang} side.

I'd like to discuss that requirement a bit further - obviously I'm not your 
management/customers/etc, so I may not be able to sway you, but I don't believe 
absence of DW_AT_defaulted would classify as DWARFv5 non-conformance to me.

Producing, say, debug_ranges instead of debug_rnglists (both in terms of teh 
section used, and the format of the bytes in that section) would be 
non-conformant. But DWARF only suggests what some forms/attributes/etc might be 
useful for, it doesn't require them by any means.

Any idea what the particular motivation for compliance is? So you/we could 
evaluate whether this feature is meeting a need or not?


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

https://reviews.llvm.org/D68117



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


[PATCH] D61675: [WIP] Update IRBuilder::CreateFNeg(...) to return a UnaryOperator

2019-10-14 Thread Cameron McInally via Phabricator via cfe-commits
cameron.mcinally added a comment.

Recommitted this patch with Ocaml test fix. I was not able to find quick-start 
documentation for the Ocaml bindings, so the Ocaml failure has not been tested. 
That said, the failure mode seems extremely low risk. Will monitor the 
buildbots for problems...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61675



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


[PATCH] D68117: [DWARF-5] Support for C++11 defaulted, deleted member functions.

2019-10-14 Thread Sourabh Singh Tomar via Phabricator via cfe-commits
SouraVX added a comment.

In D68117#1707680 , @dblaikie wrote:

> In D68117#1707578 , @SouraVX wrote:
>
> > In D68117#1702595 , @probinson 
> > wrote:
> >
> > > We really do want to pack the four mutually exclusive cases into two 
> > > bits.  I have tried to give more explicit comments inline to explain how 
> > > you would do this.  It really should work fine, recognizing that the "not 
> > > defaulted" case is not explicitly represented in the textual IR because 
> > > it uses a zero value in the defaulted/deleted subfield of SPFlags.
> >
> >
> > Thanks Paul, for suggesting this. Your approach works fine. But as I was 
> > working on some lvm-dwarfdump test cases. We seems to miss one corner case 
> > --
> >  Consider this test case;
> >  class foo{
> >
> >   foo() = default;
> >   ~foo() = default;
> >void not_special() {}
> >
> > };
> >  void not_a_member_of_foo(){}
> >
> > Now I'm getting DW_AT_defaulted getting emitted with value DW_DEFAULTED_no, 
> > for functions "not_special" and "not_a_member_of_foo". This behavior is 
> > undesirable since, DW_AT_defaulted attributes is only valid for C++ special 
> > member functions{Constructors/Destructors, ...}.
> >
> > Please correct me if I'm wrong -- Now This attributes to- implicitly 
> > defined "0" NotDefaulted bit.  which is getting checked{that's fine as long 
> > as we have a dedicated bits for distinguishing} and true for every 
> > subprogram or function in a CU.
> >  void DwarfUnit::applySubprogramAttributes( ...
> >  ...
> >  else if (SP->isNotDefaulted())
> >
> >   addUInt(SPDie, dwarf::DW_AT_defaulted, dwarf::DW_FORM_data1,
> >   dwarf::DW_DEFAULTED_no);
> >
> > ...
>
>
> Perhaps we should only emit DEFAULTED_yes, and assume anything that's not 
> DEFAULTED_yes, is... not defaulted?
>
> Also: What features is anyone planning to build with this information? I'm 
> sort of inclined not to implement features without some use-case in 
> mind/planned.


Hi David, thanks for your suggestion. But, if we do that way, we may not be 
able to capture it's location and, whether that function was defaulted in or 
out of class.

Regarding the intent behind doing this, we have an initial internal requirement 
for 100% compliance towards DWARF-5 from producer{Clang} side.


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

https://reviews.llvm.org/D68117



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


[PATCH] D68862: [ARM] Allocatable Global Register Variables for ARM

2019-10-14 Thread Anna Welker via Phabricator via cfe-commits
anwel updated this revision to Diff 224862.
anwel added a comment.

Applied some minor changes suggested in the comments, including renaming the 
array of reserved registers.


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

https://reviews.llvm.org/D68862

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/TargetInfo.h
  clang/include/clang/Driver/Options.td
  clang/lib/Basic/Targets/ARM.cpp
  clang/lib/Basic/Targets/ARM.h
  clang/lib/Driver/ToolChains/Arch/ARM.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/test/Driver/arm-reserved-reg-options.c
  clang/test/Sema/arm-global-regs.c
  llvm/lib/Target/ARM/ARM.td
  llvm/lib/Target/ARM/ARMAsmPrinter.cpp
  llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
  llvm/lib/Target/ARM/ARMFrameLowering.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMSubtarget.cpp
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/ARMTargetTransformInfo.h
  llvm/test/CodeGen/ARM/reg-alloc-fixed-r6-vla.ll
  llvm/test/CodeGen/ARM/reg-alloc-with-fixed-reg-r6-modified.ll
  llvm/test/CodeGen/ARM/reg-alloc-with-fixed-reg-r6.ll
  llvm/test/CodeGen/ARM/reg-alloc-wout-fixed-regs.ll
  llvm/test/CodeGen/Thumb/callee_save_reserved.ll
  llvm/test/Feature/reserve_global_reg.ll

Index: llvm/test/Feature/reserve_global_reg.ll
===
--- /dev/null
+++ llvm/test/Feature/reserve_global_reg.ll
@@ -0,0 +1,29 @@
+; RUN: not llc < %s -mtriple=thumbv7-apple-darwin -mattr=+reserve-r7 -o - 2>&1 | FileCheck -check-prefix=CHECK-RESERVE-FP7 %s
+; RUN: not llc < %s -mtriple=armv7-windows-msvc -mattr=+reserve-r11 -o - 2>&1 | FileCheck -check-prefix=CHECK-RESERVE-FP11 %s
+; RUN: not llc < %s -mtriple=thumbv7-windows -mattr=+reserve-r11 -o - 2>&1 | FileCheck -check-prefix=CHECK-RESERVE-FP11-2 %s
+
+; int test(int a, int b, int c) {
+;   return a + b + c;
+; }
+
+; Function Attrs: noinline nounwind optnone
+define hidden i32 @_Z4testiii(i32 %a, i32 %b, i32 %c) #0 {
+entry:
+  %a.addr = alloca i32, align 4
+  %b.addr = alloca i32, align 4
+  %c.addr = alloca i32, align 4
+  store i32 %a, i32* %a.addr, align 4
+  store i32 %b, i32* %b.addr, align 4
+  store i32 %c, i32* %c.addr, align 4
+  %0 = load i32, i32* %a.addr, align 4
+  %1 = load i32, i32* %b.addr, align 4
+  %add = add nsw i32 %0, %1
+  %2 = load i32, i32* %c.addr, align 4
+  %add1 = add nsw i32 %add, %2
+  ret i32 %add1
+}
+
+; CHECK-RESERVE-FP7: Register r7 has been specified but is used as a frame pointer on this target.
+; CHECK-RESERVE-FP11: Register r11 has been specified but is used as a frame pointer on this target.
+; CHECK-RESERVE-FP11-2: Register r11 has been specified but is used as a frame pointer on this target.
+
Index: llvm/test/CodeGen/Thumb/callee_save_reserved.ll
===
--- /dev/null
+++ llvm/test/CodeGen/Thumb/callee_save_reserved.ll
@@ -0,0 +1,15 @@
+; RUN: llc < %s -mtriple=thumbv6m-none-eabi -verify-machineinstrs -frame-pointer=none -mattr=+reserve-r6,+reserve-r8 \
+; RUN: -asm-verbose=false | FileCheck --check-prefix=CHECK-INVALID %s
+
+; Reserved low registers should not be used to correct reg deficit.
+define <4 x i32> @four_high_four_return_reserved() {
+entry:
+  ; CHECK-INVALID-NOT: r{{6|8}}
+  tail call void asm sideeffect "", "~{r8},~{r9}"()
+  %vecinit = insertelement <4 x i32> undef, i32 1, i32 0
+  %vecinit11 = insertelement <4 x i32> %vecinit, i32 2, i32 1
+  %vecinit12 = insertelement <4 x i32> %vecinit11, i32 3, i32 2
+  %vecinit13 = insertelement <4 x i32> %vecinit12, i32 4, i32 3
+  ret <4 x i32> %vecinit13
+}
+
Index: llvm/test/CodeGen/ARM/reg-alloc-wout-fixed-regs.ll
===
--- /dev/null
+++ llvm/test/CodeGen/ARM/reg-alloc-wout-fixed-regs.ll
@@ -0,0 +1,58 @@
+; RUN: llc < %s -mtriple=arm-linux-gnueabi  -O0 -filetype=asm --regalloc=fast 2>&1 | FileCheck %s
+;
+; Equivalent C source code
+; void bar(unsigned int i,
+;  unsigned int j,
+;  unsigned int k,
+;  unsigned int l,
+;  unsigned int m,
+;  unsigned int n,
+;  unsigned int o,
+;  unsigned int p)
+; {
+; unsigned int result = i + j + k + l + m + n + o + p;
+; }
+
+define void @bar(i32 %i, i32 %j, i32 %k, i32 %l, i32 %m, i32 %n, i32 %o, i32 %p) nounwind {
+entry:
+; CHECK: push {{{.*}}r4, r5{{.*}}}
+  %i.addr = alloca i32, align 4
+  %j.addr = alloca i32, align 4
+  %k.addr = alloca i32, align 4
+  %l.addr = alloca i32, align 4
+  %m.addr = alloca i32, align 4
+  %n.addr = alloca i32, align 4
+  %o.addr = alloca i32, align 4
+  %p.addr = alloca i32, align 4
+  %result = alloca i32, align 4
+  store i32 %i, i32* %i.addr, align 4
+  store i32 %j, i32* %j.addr, align 4
+  store i32 %k, i32* %k.addr, align 4
+  store 

[PATCH] D68862: [ARM] Allocatable Global Register Variables for ARM

2019-10-14 Thread Carey Williams via Phabricator via cfe-commits
carwil added a comment.

> IMHO, since reserved registes are per-function, this strongly suggests 
> implementation as function attribute(s), rather than subtarget features (also 
> for the pre-existing r9).

What do you mean reserved registers are per-function? That sounds like you're 
describing local register variables, which I don't believe Clang has any 
support for (and there aren't a great deal of use-cases for anyway). We're 
specifically talking about global usage here.


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

https://reviews.llvm.org/D68862



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


[PATCH] D67031: [Clang][Bundler] Error reporting improvements

2019-10-14 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp:133
   /// returned if there are no more bundles to be read.
-  virtual StringRef ReadBundleStart(MemoryBuffer ) = 0;
+  virtual Expected>
+  ReadBundleStart(MemoryBuffer ) = 0;

sdmitriev wrote:
> sdmitriev wrote:
> > ABataev wrote:
> > > Do we really need an inner `Optional` here?
> > The idea was to return `StringRef` with bundle name when we have still have 
> > bundles and `None` when there are no more bundles in the file (BTW comment 
> > has to be updated to describe this). But I can restore the old convention 
> > where empty bundle name means 'no more bundles' in the file. In terms of 
> > functionality that would be the same, though use of `Optional<...>` makes 
> > intentions more explicit))
> I have updated comment to describe the intended behavior.
> @ABataev do you insist on removing inner `Optional<>` and restoring the 
> current convention where empty string means the end of bundles in the file?
The problem here is that `Expected` already handles the state and we have inner 
`Optional` for the same reason. Can we reuse `Expected` to indicate that there 
are no more bundles?


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

https://reviews.llvm.org/D67031



___
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-10-14 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

@khchen Thanks for your patch! It is now landed.


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] D67409: [RISCV] enable LTO support, pass some options to linker.

2019-10-14 Thread Sam Elliott via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcdcf58e5af02: [RISCV] enable LTO support, pass some options 
to linker. (authored by lenary).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67409

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/RISCVToolchain.cpp
  clang/lib/Driver/ToolChains/RISCVToolchain.h
  clang/test/Driver/gold-lto.c

Index: clang/test/Driver/gold-lto.c
===
--- clang/test/Driver/gold-lto.c
+++ clang/test/Driver/gold-lto.c
@@ -26,3 +26,21 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
+//
+// RUN: %clang -target riscv64-unknown-elf -### %t.o -flto 2>&1 \
+// RUN: -march=rv64imf -mabi=lp64f \
+// RUN: | FileCheck %s --check-prefix=CHECK-RISCV-BAREMETAL
+// CHECK-RISCV-BAREMETAL: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-mattr=+m"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-mattr=+f"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-mattr=+relax"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-target-abi=lp64f"
+//
+// RUN: %clang -target riscv64-unknown-linux-gnu -### %t.o -flto 2>&1 \
+// RUN: -march=rv64imf -mabi=lp64f \
+// RUN: | FileCheck %s --check-prefix=CHECK-RISCV-LINUX
+// CHECK-RISCV-LINUX: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
+// CHECK-RISCV-LINUX: "-plugin-opt=-mattr=+m"
+// CHECK-RISCV-LINUX: "-plugin-opt=-mattr=+f"
+// CHECK-RISCV-LINUX: "-plugin-opt=-mattr=+relax"
+// CHECK-RISCV-LINUX: "-plugin-opt=-target-abi=lp64f"
Index: clang/lib/Driver/ToolChains/RISCVToolchain.h
===
--- clang/lib/Driver/ToolChains/RISCVToolchain.h
+++ clang/lib/Driver/ToolChains/RISCVToolchain.h
@@ -25,6 +25,7 @@
   void addClangTargetOptions(const llvm::opt::ArgList ,
  llvm::opt::ArgStringList ,
  Action::OffloadKind) const override;
+  bool HasNativeLLVMSupport() const override { return true; }
   void
   AddClangSystemIncludeArgs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const override;
Index: clang/lib/Driver/ToolChains/RISCVToolchain.cpp
===
--- clang/lib/Driver/ToolChains/RISCVToolchain.cpp
+++ clang/lib/Driver/ToolChains/RISCVToolchain.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "RISCVToolchain.h"
+#include "Arch/RISCV.h"
 #include "CommonArgs.h"
 #include "InputInfo.h"
 #include "clang/Driver/Compilation.h"
@@ -100,6 +101,12 @@
 
   std::string Linker = getToolChain().GetProgramPath(getShortName());
 
+  if (D.isUsingLTO()) {
+assert(!Inputs.empty() && "Must have at least one input.");
+AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+  D.getLTOMode() == LTOK_Thin);
+  }
+
   bool WantCRTs =
   !Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);
 
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -118,6 +118,14 @@
 void addMultilibFlag(bool Enabled, const char *const Flag,
  Multilib::flags_list );
 
+StringRef getTargetABI(const llvm::opt::ArgList ,
+   const llvm::Triple );
+
+void getTargetFeatures(const ToolChain , const llvm::Triple ,
+   const llvm::opt::ArgList ,
+   llvm::opt::ArgStringList , bool ForAS,
+   bool ForLTOPlugin = false);
+
 } // end namespace tools
 } // end namespace driver
 } // end namespace clang
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -11,8 +11,12 @@
 #include "Arch/ARM.h"
 #include "Arch/Mips.h"
 #include "Arch/PPC.h"
+#include "Arch/RISCV.h"
+#include "Arch/Sparc.h"
 #include "Arch/SystemZ.h"
 #include "Arch/X86.h"
+#include "AMDGPU.h"
+#include "MSP430.h"
 #include "HIP.h"
 #include "Hexagon.h"
 #include "InputInfo.h"
@@ -484,6 +488,14 @@
   if (!StatsFile.empty())
 CmdArgs.push_back(
 Args.MakeArgString(Twine("-plugin-opt=stats-file=") + StatsFile));
+
+  getTargetFeatures(ToolChain, ToolChain.getTriple(), Args, CmdArgs,
+/* ForAS= */ false, /* ForLTOPlugin= */ true);
+
+  StringRef ABIName = tools::getTargetABI(Args, 

r374774 - [RISCV] enable LTO support, pass some options to linker.

2019-10-14 Thread Sam Elliott via cfe-commits
Author: lenary
Date: Mon Oct 14 07:00:13 2019
New Revision: 374774

URL: http://llvm.org/viewvc/llvm-project?rev=374774=rev
Log:
[RISCV] enable LTO support, pass some options to linker.

Summary:
1. enable LTO need to pass target feature and abi to LTO code generation
   RISCV backend need the target feature to decide which extension used in
   code generation.
2. move getTargetFeatures to CommonArgs.h and add ForLTOPlugin flag
3. add general tools::getTargetABI in CommonArgs.h because different target 
uses different
   way to get the target ABI.

Patch by Kuan Hsu Chen (khchen)

Reviewers: lenary, lewis-revill, asb, MaskRay

Reviewed By: lenary

Subscribers: hiraditya, dschuff, aheejin, fedor.sergeev, mehdi_amini, 
inglorion, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, 
kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, steven_wu, 
rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, rkruppe, PkmX, jocewei, 
psnobl, benna, Jim, lenary, s.egerton, pzheng, cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.h
cfe/trunk/lib/Driver/ToolChains/RISCVToolchain.cpp
cfe/trunk/lib/Driver/ToolChains/RISCVToolchain.h
cfe/trunk/test/Driver/gold-lto.c

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=374774=374773=374774=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Oct 14 07:00:13 2019
@@ -302,95 +302,6 @@ static void ParseMPreferVectorWidth(cons
   }
 }
 
-static void getWebAssemblyTargetFeatures(const ArgList ,
- std::vector ) {
-  handleTargetFeaturesGroup(Args, Features, 
options::OPT_m_wasm_Features_Group);
-}
-
-static void getTargetFeatures(const ToolChain , const llvm::Triple ,
-  const ArgList , ArgStringList ,
-  bool ForAS) {
-  const Driver  = TC.getDriver();
-  std::vector Features;
-  switch (Triple.getArch()) {
-  default:
-break;
-  case llvm::Triple::mips:
-  case llvm::Triple::mipsel:
-  case llvm::Triple::mips64:
-  case llvm::Triple::mips64el:
-mips::getMIPSTargetFeatures(D, Triple, Args, Features);
-break;
-
-  case llvm::Triple::arm:
-  case llvm::Triple::armeb:
-  case llvm::Triple::thumb:
-  case llvm::Triple::thumbeb:
-arm::getARMTargetFeatures(TC, Triple, Args, CmdArgs, Features, ForAS);
-break;
-
-  case llvm::Triple::ppc:
-  case llvm::Triple::ppc64:
-  case llvm::Triple::ppc64le:
-ppc::getPPCTargetFeatures(D, Triple, Args, Features);
-break;
-  case llvm::Triple::riscv32:
-  case llvm::Triple::riscv64:
-riscv::getRISCVTargetFeatures(D, Triple, Args, Features);
-break;
-  case llvm::Triple::systemz:
-systemz::getSystemZTargetFeatures(Args, Features);
-break;
-  case llvm::Triple::aarch64:
-  case llvm::Triple::aarch64_be:
-aarch64::getAArch64TargetFeatures(D, Triple, Args, Features);
-break;
-  case llvm::Triple::x86:
-  case llvm::Triple::x86_64:
-x86::getX86TargetFeatures(D, Triple, Args, Features);
-break;
-  case llvm::Triple::hexagon:
-hexagon::getHexagonTargetFeatures(D, Args, Features);
-break;
-  case llvm::Triple::wasm32:
-  case llvm::Triple::wasm64:
-getWebAssemblyTargetFeatures(Args, Features);
-break;
-  case llvm::Triple::sparc:
-  case llvm::Triple::sparcel:
-  case llvm::Triple::sparcv9:
-sparc::getSparcTargetFeatures(D, Args, Features);
-break;
-  case llvm::Triple::r600:
-  case llvm::Triple::amdgcn:
-amdgpu::getAMDGPUTargetFeatures(D, Args, Features);
-break;
-  case llvm::Triple::msp430:
-msp430::getMSP430TargetFeatures(D, Args, Features);
-  }
-
-  // Find the last of each feature.
-  llvm::StringMap LastOpt;
-  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
-StringRef Name = Features[I];
-assert(Name[0] == '-' || Name[0] == '+');
-LastOpt[Name.drop_front(1)] = I;
-  }
-
-  for (unsigned I = 0, N = Features.size(); I < N; ++I) {
-// If this feature was overridden, ignore it.
-StringRef Name = Features[I];
-llvm::StringMap::iterator LastI = 
LastOpt.find(Name.drop_front(1));
-assert(LastI != LastOpt.end());
-unsigned Last = LastI->second;
-if (Last != I)
-  continue;
-
-CmdArgs.push_back("-target-feature");
-CmdArgs.push_back(Name.data());
-  }
-}
-
 static bool
 shouldUseExceptionTablesForObjCExceptions(const ObjCRuntime ,
   const llvm::Triple ) {

Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=374774=374773=374774=diff

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

2019-10-14 Thread Kuan Hsu Chen via Phabricator via cfe-commits
khchen added a comment.

In D67409#1707940 , @lenary wrote:

> @khchen do you need me to commit this for you?


Yes, please help me, thanks.


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] D67409: [RISCV] enable LTO support, pass some options to linker.

2019-10-14 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

@khchen do you need me to commit this for you?


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] D68028: [clang] Add no_builtin attribute

2019-10-14 Thread Guillaume Chatelet via Phabricator via cfe-commits
gchatelet added a comment.

A gentle ping @aaron.ballman


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68028



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


[PATCH] D66733: [analyzer] Add a checker option to detect nested dead stores

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

In D66733#1706521 , @sylvestre.ledru 
wrote:

> I added it to the release notes here : https://reviews.llvm.org/rC374593
>  I am wondering if the option( WarnForDeadNestedAssignments ) to disable it 
> is really necessary?
>  I haven't seen any false positive while deadstore has some.


Thank you!! Well, the option was in place in case some false positives do arise 
from this, but we did suspect that wouldn't happen. I'm not against removing it 
completely, or hiding it (so that it would only be listed under 
`-analyzer-checker-option-help-developer`).

Some of folks working on the analyzer are preparing for the conference, hence 
the slower response time, sorry :^)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66733



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


[PATCH] D67185: [RISCV] Add support for -ffixed-xX flags

2019-10-14 Thread Simon Cook via Phabricator via cfe-commits
simoncook marked 2 inline comments as done.
simoncook added inline comments.



Comment at: clang/include/clang/Driver/Options.td:2224
   HelpText<"Don't workaround Cortex-A53 erratum 835769 (AArch64 only)">;
-foreach i = {1-7,9-15,18,20-28} in
-  def ffixed_x#i : Flag<["-"], "ffixed-x"#i>, Group,
-HelpText<"Reserve the "#i#" register (AArch64 only)">;
+foreach i = {1-31} in
+  def ffixed_x#i : Flag<["-"], "ffixed-x"#i>, Group,

luismarques wrote:
> Given the expansion of the flags here, the AArch64 driver should probably 
> detect and reject the flags `-ffixed-x[8,16-17,19,29-31]`, to preserve the 
> old behavior where passing those flags  would be an error and to ensure that 
> erroneous flags are not silently accepted.
With this patch, for AArch64 using -ffixed-x8 for example will produce a 
warning that the flag is unused, similar to any other architecture trying to 
use these flags; I'll look at a follow-up patch that explicitly produces errors.



Comment at: llvm/lib/Target/RISCV/RISCVSubtarget.cpp:53
 : RISCVGenSubtargetInfo(TT, CPU, FS),
+  UserReservedRegister(RISCV::NUM_TARGET_REGS),
   FrameLowering(initializeSubtargetDependencies(TT, CPU, FS, ABIName)),

luismarques wrote:
> This includes more than the x0 - x31 registers. If the intent is to only 
> allow reserving the GPRs then this should be tightened.
For now this only covers GPRs, but going forward I was going to follow up with 
one for floating point, since these should also be reservable if we match all 
of GCCs behaviour, where every register should be marked as reserved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67185



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


[PATCH] D67185: [RISCV] Add support for -ffixed-xX flags

2019-10-14 Thread Sam Elliott via Phabricator via cfe-commits
lenary added a comment.

Note, D68862  is in-progress at the moment, 
which is related to this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67185



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


[PATCH] D68937: [clangd] Add parameter renaming to define-inline code action

2019-10-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
kadircet added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous, MaskRay.
Herald added a project: clang.

When moving a function definition to declaration location we also need
to handle renaming of the both function and template parameters.

This patch achives that by making sure every parameter name and dependent type
in destination is renamed to their respective name in the source.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68937

Files:
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -1285,6 +1285,44 @@
 )cpp");
 }
 
+TEST_F(DefineInlineTest, TransformParamNames) {
+  EXPECT_EQ(apply(R"cpp(
+void foo(int, bool b);
+
+void ^foo(int f, bool x) {})cpp"), R"cpp(
+void foo(int f, bool x){}
+
+)cpp");
+}
+
+TEST_F(DefineInlineTest, TransformTemplParamNames) {
+  EXPECT_EQ(apply(R"cpp(
+struct Foo {
+  struct Bar {
+template  class, template class Y,
+  int, int Z>
+void foo(X, Y, int W = 5 * Z + 2);
+  };
+};
+
+template  class V, template class W,
+  int X, int Y>
+void Foo::Bar::f^oo(U, W, int Q) {})cpp"),
+R"cpp(
+struct Foo {
+  struct Bar {
+template  class V, template class W,
+  int X, int Y>
+void foo(U, W, int Q = 5 * Y + 2){}
+  };
+};
+
+)cpp");
+}
+
 TEST_F(DefineInlineTest, TransformInlineNamespaces) {
   EXPECT_EQ(apply(R"cpp(
 namespace a { inline namespace b { namespace { struct Foo{}; } } }
Index: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
===
--- clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
@@ -226,6 +226,176 @@
   return QualifiedFunc->substr(BodyBegin, BodyEnd - BodyBegin + 1);
 }
 
+/// Generates a replacement that renames \p Dest to \p Source.
+llvm::Error rewriteParameterName(tooling::Replacements ,
+ const NamedDecl *Dest,
+ const NamedDecl *Source) {
+  auto  = Dest->getASTContext().getSourceManager();
+  llvm::StringRef DestName = Dest->getName();
+  llvm::StringRef SourceName = Source->getName();
+  if (DestName == SourceName)
+return llvm::Error::success();
+  if (auto Err = Replacements.add(tooling::Replacement(
+  SM, Dest->getLocation(), DestName.size(),
+  // If \p Dest is unnamed, we need to insert a space before current
+  // name.
+  ((DestName.empty() ? " " : "") + SourceName).str( {
+return Err;
+  }
+  return llvm::Error::success();
+}
+
+/// Returns a mapping from template names in \p Dest to \p Source, so that they
+/// can be updated in other places like parameter types and default arguments.
+llvm::Expected>
+renameTemplateParameters(tooling::Replacements ,
+ const FunctionDecl *Dest, const FunctionDecl *Source) {
+  llvm::DenseMap TemplParamNameDestToSource;
+
+  auto *DestTempl = Dest->getDescribedFunctionTemplate();
+  auto *SourceTempl = Source->getDescribedFunctionTemplate();
+  assert(bool(DestTempl) == bool(SourceTempl));
+  if (DestTempl) {
+const auto *DestTPL = DestTempl->getTemplateParameters();
+const auto *SourceTPL = SourceTempl->getTemplateParameters();
+assert(DestTPL->size() == SourceTPL->size());
+
+for (size_t I = 0, EP = DestTPL->size(); I != EP; ++I) {
+  if (auto Err = rewriteParameterName(Replacements, DestTPL->getParam(I),
+  SourceTPL->getParam(I)))
+return std::move(Err);
+  TemplParamNameDestToSource[DestTPL->getParam(I)->getName()] =
+  SourceTPL->getParam(I)->getName();
+}
+  }
+
+  return TemplParamNameDestToSource;
+}
+
+/// Generates replacements for rewriting dependent types in \p DestParam to the
+/// matching template name in \p TemplParamNameDestToSource.
+llvm::Error
+rewriteParameterType(tooling::Replacements ,
+ const ParmVarDecl *DestParam,
+ const llvm::DenseMap
+ ) {
+  auto *DestTSI = DestParam->getTypeSourceInfo();
+  if (!DestTSI)
+return llvm::Error::success();
+  const SourceManager  = DestParam->getASTContext().getSourceManager();
+
+  // Update paramater types if they are template template or type template.
+  auto DestTL = DestTSI->getTypeLoc();
+  if (auto DestTPTL = DestTL.getAs()) {
+if (auto Err = Replacements.add(tooling::Replacement(
+SM, CharSourceRange(DestTPTL.getSourceRange(), /*ITR=*/true),
+

[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments.



Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp:226
+llvm::Expected
+renameParameters(const FunctionDecl *Dest, const FunctionDecl *Source) {
+  const SourceManager  = Dest->getASTContext().getSourceManager();

kadircet wrote:
> ilya-biryukov wrote:
> > This does not rename any references to those parameters, right?
> > E.g.
> > ```
> > template  void foo(T x);
> > 
> > template  void foo(U x) {}
> > ```
> > 
> > would turn into
> > ```
> > template  void foo(T x);
> > ```
> > right?
> yes that's right, just adding a unittest will address this later on
moving into D68937, since it got bigger than expected.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66647



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


[PATCH] D66647: [clangd] DefineInline action apply logic with fully qualified names

2019-10-14 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 224824.
kadircet added a comment.

- Move parameter renaming logic to a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66647

Files:
  clang-tools-extra/clangd/refactor/tweaks/DefineInline.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.h
  clang-tools-extra/clangd/unittests/TweakTests.cpp

Index: clang-tools-extra/clangd/unittests/TweakTests.cpp
===
--- clang-tools-extra/clangd/unittests/TweakTests.cpp
+++ clang-tools-extra/clangd/unittests/TweakTests.cpp
@@ -25,6 +25,7 @@
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -103,7 +104,7 @@
   EXPECT_UNAVAILABLE(R"cpp(R"(multi )" ^"token " u8"str\ning")cpp"); // nonascii
   EXPECT_UNAVAILABLE(R"cpp(^R^"^(^multi )" "token " "str\ning")cpp"); // raw
   EXPECT_UNAVAILABLE(R"cpp(^"token\n" __FILE__)cpp"); // chunk is macro
-  EXPECT_UNAVAILABLE(R"cpp(^"a\r\n";)cpp"); // forbidden escape char
+  EXPECT_UNAVAILABLE(R"cpp(^"a\r\n";)cpp");   // forbidden escape char
 
   const char *Input = R"cpp(R"(multi
 token)" "\nst^ring\n" "literal")cpp";
@@ -826,6 +827,477 @@
   })cpp");
 }
 
+TEST_F(DefineInlineTest, TransformUsings) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+  void bar();
+  namespace b {
+  void baz();
+  namespace c {
+  void aux();
+  }
+  }
+  }
+
+  void foo();
+  void f^oo() {
+using namespace a;
+
+using namespace b;
+using namespace a::b;
+
+using namespace c;
+using namespace b::c;
+using namespace a::b::c;
+
+using a::bar;
+
+using b::baz;
+using a::b::baz;
+
+using c::aux;
+using b::c::aux;
+using a::b::c::aux;
+
+namespace d = c;
+namespace d = b::c;
+  }
+  )cpp"),
+R"cpp(
+  namespace a {
+  void bar();
+  namespace b {
+  void baz();
+  namespace c {
+  void aux();
+  }
+  }
+  }
+
+  void foo(){
+using namespace a;
+
+using namespace a::b;
+using namespace a::b;
+
+using namespace a::b::c;
+using namespace a::b::c;
+using namespace a::b::c;
+
+using a::bar;
+
+using a::b::baz;
+using a::b::baz;
+
+using a::b::c::aux;
+using a::b::c::aux;
+using a::b::c::aux;
+
+namespace d = a::b::c;
+namespace d = a::b::c;
+  }
+  
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformDecls) {
+  EXPECT_EQ(apply(R"cpp(
+  void foo()/*Comment -_-*/  ;
+
+  void f^oo() {
+class Foo {
+public:
+  void foo();
+  int x;
+  static int y;
+};
+Foo::y = 0;
+
+enum En { Zero, One };
+En x = Zero;
+
+enum class EnClass { Zero, One };
+EnClass y = EnClass::Zero;
+
+template  class Bar {};
+Bar z;
+  }
+  )cpp"),
+R"cpp(
+  void foo()/*Comment -_-*/  {
+class Foo {
+public:
+  void foo();
+  int x;
+  static int y;
+};
+Foo::y = 0;
+
+enum En { Zero, One };
+En x = Zero;
+
+enum class EnClass { Zero, One };
+EnClass y = EnClass::Zero;
+
+template  class Bar {};
+Bar z;
+  }
+
+  
+  )cpp");
+}
+
+TEST_F(DefineInlineTest, TransformTemplDecls) {
+  EXPECT_EQ(apply(R"cpp(
+  namespace a {
+template  class Bar {
+public:
+  void bar();
+};
+template  T bar;
+template  void aux() {}
+  }
+
+  void foo()/*Comment -_-*/  ;
+
+  void f^oo() {
+using namespace a;
+bar>.bar();
+aux>();
+  }
+  )cpp"),
+R"cpp(
+  namespace a {
+template  class Bar {
+public:
+  void bar();
+};
+template  T bar;
+template  void aux() {}
+  }
+
+  void foo()/*Comment -_-*/  {
+using namespace a;
+a::bar>.bar();
+a::aux>();
+  }
+
+  
+  )cpp");
+}
+
+MATCHER_P2(FileWithContents, FileName, Contents, "") {
+  return arg.first() == FileName && arg.second == Contents;
+}
+
+TEST_F(DefineInlineTest, TransformMembers) {
+  EXPECT_EQ(apply(R"cpp(
+  class Foo {
+void foo()/*Comment -_-*/  ;
+  };
+
+  void Foo::f^oo() {
+return;
+  }
+  )cpp"),
+R"cpp(
+  class Foo {
+void foo()/*Comment -_-*/  {
+return;
+  }
+  };
+
+  
+  )cpp");
+
+  ExtraFiles["a.h"] = R"cpp(
+  class Foo {
+void foo()/*Comment -_-*/  ;
+  };)cpp";
+
+  llvm::StringMap EditedFiles;
+  EXPECT_EQ(apply(R"cpp(
+  #include "a.h"
+  void Foo::f^oo() {
+return;
+  })cpp",
+  ),
+R"cpp(
+  #include "a.h"
+  )cpp");
+  EXPECT_THAT(EditedFiles,
+  testing::ElementsAre(FileWithContents(testPath("a.h"),
+R"cpp(
+  class Foo {
+void foo()/*Comment -_-*/  {
+return;
+  }
+  

[PATCH] D68581: Include leading attributes in DeclStmt's SourceRange

2019-10-14 Thread Stephan Bergmann via Phabricator via cfe-commits
sberg updated this revision to Diff 224823.

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

https://reviews.llvm.org/D68581

Files:
  clang/lib/Parse/ParseStmt.cpp
  clang/test/AST/sourceranges.cpp


Index: clang/test/AST/sourceranges.cpp
===
--- clang/test/AST/sourceranges.cpp
+++ clang/test/AST/sourceranges.cpp
@@ -144,3 +144,18 @@
   }
 }
 #endif
+
+// CHECK: NamespaceDecl {{.*}} attributed_decl
+namespace attributed_decl {
+  void cpp11() {
+// CHECK: DeclStmt {{.*}} 
+int __attribute__((unused)) i;
+  }
+
+#if __cplusplus >= 201703L
+  void cpp17() {
+// CHECK-1Z: DeclStmt {{.*}} 
+[[maybe_unused]] int i;
+  }
+#endif
+}
Index: clang/lib/Parse/ParseStmt.cpp
===
--- clang/lib/Parse/ParseStmt.cpp
+++ clang/lib/Parse/ParseStmt.cpp
@@ -220,6 +220,8 @@
 Decl =
 ParseDeclaration(DeclaratorContext::BlockContext, DeclEnd, Attrs);
   }
+  if (Attrs.Range.getBegin().isValid())
+DeclStart = Attrs.Range.getBegin();
   return Actions.ActOnDeclStmt(Decl, DeclStart, DeclEnd);
 }
 


Index: clang/test/AST/sourceranges.cpp
===
--- clang/test/AST/sourceranges.cpp
+++ clang/test/AST/sourceranges.cpp
@@ -144,3 +144,18 @@
   }
 }
 #endif
+
+// CHECK: NamespaceDecl {{.*}} attributed_decl
+namespace attributed_decl {
+  void cpp11() {
+// CHECK: DeclStmt {{.*}} 
+int __attribute__((unused)) i;
+  }
+
+#if __cplusplus >= 201703L
+  void cpp17() {
+// CHECK-1Z: DeclStmt {{.*}} 
+[[maybe_unused]] int i;
+  }
+#endif
+}
Index: clang/lib/Parse/ParseStmt.cpp
===
--- clang/lib/Parse/ParseStmt.cpp
+++ clang/lib/Parse/ParseStmt.cpp
@@ -220,6 +220,8 @@
 Decl =
 ParseDeclaration(DeclaratorContext::BlockContext, DeclEnd, Attrs);
   }
+  if (Attrs.Range.getBegin().isValid())
+DeclStart = Attrs.Range.getBegin();
   return Actions.ActOnDeclStmt(Decl, DeclStart, DeclEnd);
 }
 
___
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-10-14 Thread Kuan Hsu Chen via Phabricator via cfe-commits
khchen updated this revision to Diff 224821.
khchen added a comment.

rebase master, 
https://reviews.llvm.org/D66003 changed the `riscv::getRISCVTargetFeatures` 
interface.


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

https://reviews.llvm.org/D67409

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/lib/Driver/ToolChains/CommonArgs.h
  clang/lib/Driver/ToolChains/RISCVToolchain.cpp
  clang/lib/Driver/ToolChains/RISCVToolchain.h
  clang/test/Driver/gold-lto.c

Index: clang/test/Driver/gold-lto.c
===
--- clang/test/Driver/gold-lto.c
+++ clang/test/Driver/gold-lto.c
@@ -26,3 +26,21 @@
 // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID
 // CHECK-X86-ANDROID: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
+//
+// RUN: %clang -target riscv64-unknown-elf -### %t.o -flto 2>&1 \
+// RUN: -march=rv64imf -mabi=lp64f \
+// RUN: | FileCheck %s --check-prefix=CHECK-RISCV-BAREMETAL
+// CHECK-RISCV-BAREMETAL: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-mattr=+m"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-mattr=+f"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-mattr=+relax"
+// CHECK-RISCV-BAREMETAL: "-plugin-opt=-target-abi=lp64f"
+//
+// RUN: %clang -target riscv64-unknown-linux-gnu -### %t.o -flto 2>&1 \
+// RUN: -march=rv64imf -mabi=lp64f \
+// RUN: | FileCheck %s --check-prefix=CHECK-RISCV-LINUX
+// CHECK-RISCV-LINUX: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
+// CHECK-RISCV-LINUX: "-plugin-opt=-mattr=+m"
+// CHECK-RISCV-LINUX: "-plugin-opt=-mattr=+f"
+// CHECK-RISCV-LINUX: "-plugin-opt=-mattr=+relax"
+// CHECK-RISCV-LINUX: "-plugin-opt=-target-abi=lp64f"
Index: clang/lib/Driver/ToolChains/RISCVToolchain.h
===
--- clang/lib/Driver/ToolChains/RISCVToolchain.h
+++ clang/lib/Driver/ToolChains/RISCVToolchain.h
@@ -25,6 +25,7 @@
   void addClangTargetOptions(const llvm::opt::ArgList ,
  llvm::opt::ArgStringList ,
  Action::OffloadKind) const override;
+  bool HasNativeLLVMSupport() const override { return true; }
   void
   AddClangSystemIncludeArgs(const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const override;
Index: clang/lib/Driver/ToolChains/RISCVToolchain.cpp
===
--- clang/lib/Driver/ToolChains/RISCVToolchain.cpp
+++ clang/lib/Driver/ToolChains/RISCVToolchain.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "RISCVToolchain.h"
+#include "Arch/RISCV.h"
 #include "CommonArgs.h"
 #include "InputInfo.h"
 #include "clang/Driver/Compilation.h"
@@ -100,6 +101,12 @@
 
   std::string Linker = getToolChain().GetProgramPath(getShortName());
 
+  if (D.isUsingLTO()) {
+assert(!Inputs.empty() && "Must have at least one input.");
+AddGoldPlugin(ToolChain, Args, CmdArgs, Output, Inputs[0],
+  D.getLTOMode() == LTOK_Thin);
+  }
+
   bool WantCRTs =
   !Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);
 
Index: clang/lib/Driver/ToolChains/CommonArgs.h
===
--- clang/lib/Driver/ToolChains/CommonArgs.h
+++ clang/lib/Driver/ToolChains/CommonArgs.h
@@ -118,6 +118,14 @@
 void addMultilibFlag(bool Enabled, const char *const Flag,
  Multilib::flags_list );
 
+StringRef getTargetABI(const llvm::opt::ArgList ,
+   const llvm::Triple );
+
+void getTargetFeatures(const ToolChain , const llvm::Triple ,
+   const llvm::opt::ArgList ,
+   llvm::opt::ArgStringList , bool ForAS,
+   bool ForLTOPlugin = false);
+
 } // end namespace tools
 } // end namespace driver
 } // end namespace clang
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -11,8 +11,12 @@
 #include "Arch/ARM.h"
 #include "Arch/Mips.h"
 #include "Arch/PPC.h"
+#include "Arch/RISCV.h"
+#include "Arch/Sparc.h"
 #include "Arch/SystemZ.h"
 #include "Arch/X86.h"
+#include "AMDGPU.h"
+#include "MSP430.h"
 #include "HIP.h"
 #include "Hexagon.h"
 #include "InputInfo.h"
@@ -484,6 +488,14 @@
   if (!StatsFile.empty())
 CmdArgs.push_back(
 Args.MakeArgString(Twine("-plugin-opt=stats-file=") + StatsFile));
+
+  getTargetFeatures(ToolChain, ToolChain.getTriple(), Args, CmdArgs,
+/* ForAS= */ false, /* ForLTOPlugin= */ true);
+
+  StringRef ABIName = tools::getTargetABI(Args, ToolChain.getTriple());
+  if (!ABIName.empty())
+

[PATCH] D68914: [clang-format] Remove duplciate code from Invalid BOM detection

2019-10-14 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

I tend to agree mainly given that StringRef is used without const elsewhere. 
I'll bow to better judgement.


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

https://reviews.llvm.org/D68914



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


[PATCH] D68554: [clang-format] Proposal for clang-format to give compiler style warnings

2019-10-14 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

In D68554#1707540 , @thakis wrote:

> >   Could you or anyone else point me to a good example, I'd definitely like 
> > to take a look.
>
> http://llvm-cs.pcc.me.uk/include/llvm/Support/SourceMgr.h/rSMDiagnostic --
>
> >   `via clang-format?` did you mean via clang.exe or clang-check.exe?   I 
> > did think of this when I started doing this work, I just came to the 
> > conclusion that if I did that it wouldn't be long before someone requested 
> > the same features in clang-format itself.
>
> Err, via clang-tidy. Sorry, that was a super confusing typo. That seems like 
> a great place for this feature to me.


clang-tidy is a compiler tool that needs the full compile info, while 
clang-format is just a parser; I think it'd be actively confusing to have 
clang-tidy be a clang-format frontend given how different there usage is.

That said, I agree it's worth looking into using LLVM Diags without all of 
Clang's overhead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68554



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


  1   2   >