r322005 - Emit Function IDs table for Control Flow Guard

2018-01-08 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Mon Jan  8 08:33:42 2018
New Revision: 322005

URL: http://llvm.org/viewvc/llvm-project?rev=322005&view=rev
Log:
Emit Function IDs table for Control Flow Guard

Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs
of functions that have their address taken into a section named .gfids$y for
compatibility with Microsoft's Control Flow Guard feature.

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

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=322005&r1=322004&r2=322005&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Mon Jan  8 08:33:42 2018
@@ -235,6 +235,8 @@ def _SLASH_Fi : CLCompileJoined<"Fi">,
 def _SLASH_Fo : CLCompileJoined<"Fo">,
   HelpText<"Set output object file, or directory (ends in / or \\) (with /c)">,
   MetaVarName<"">;
+def _SLASH_Guard : CLJoined<"guard:">,
+  HelpText<"Enable Control Flow Guard with /guard:cf">;
 def _SLASH_GX : CLFlag<"GX">,
   HelpText<"Enable exception handling">;
 def _SLASH_GX_ : CLFlag<"GX-">,
@@ -364,7 +366,6 @@ def _SLASH_GL_ : CLFlag<"GL-">;
 def _SLASH_Gm : CLFlag<"Gm">;
 def _SLASH_Gm_ : CLFlag<"Gm-">;
 def _SLASH_GT : CLFlag<"GT">;
-def _SLASH_Guard : CLJoined<"guard:">;
 def _SLASH_GZ : CLFlag<"GZ">;
 def _SLASH_H : CLFlag<"H">;
 def _SLASH_homeparams : CLFlag<"homeparams">;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=322005&r1=322004&r2=322005&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Jan  8 08:33:42 2018
@@ -492,6 +492,8 @@ def bind__at__load : Flag<["-"], "bind_a
 def bundle__loader : Separate<["-"], "bundle_loader">;
 def bundle : Flag<["-"], "bundle">;
 def b : JoinedOrSeparate<["-"], "b">, Flags<[Unsupported]>;
+def cfguard : Flag<["-"], "cfguard">, Flags<[CC1Option]>,
+  HelpText<"Emit tables required for Windows Control Flow Guard.">;
 def cl_opt_disable : Flag<["-"], "cl-opt-disable">, Group, 
Flags<[CC1Option]>,
   HelpText<"OpenCL only. This option disables all optimizations. By default 
optimizations are enabled.">;
 def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">, 
Group, Flags<[CC1Option]>,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=322005&r1=322004&r2=322005&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Mon Jan  8 08:33:42 2018
@@ -38,6 +38,7 @@ CODEGENOPT(AssumeSaneOperatorNew , 1, 1)
 CODEGENOPT(Autolink  , 1, 1) ///< -fno-autolink
 CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be 
EH-safe.
 CODEGENOPT(Backchain , 1, 0) ///< -mbackchain
+CODEGENOPT(ControlFlowGuard  , 1, 0) ///< -cfguard
 CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum 
for functions in GCNO files.
 CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function 
names in GCDA files.
 CODEGENOPT(CoverageExitBlockBeforeBody, 1, 0) ///< Whether to emit the exit 
block before the body blocks in GCNO files.

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=322005&r1=322004&r2=322005&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jan  8 08:33:42 2018
@@ -456,6 +456,10 @@ void CodeGenModule::Release() {
 // Indicate that we want CodeView in the metadata.
 getModule().addModuleFlag(llvm::Module::Warning, "CodeView", 1);
   }
+  if (CodeGenOpts.ControlFlowGuard) {
+// We want function ID tables for Control Flow Guard.
+getModule().addModuleFlag(llvm::Module::Warning, "cfguard", 1);
+  }
   if (CodeGenOpts.OptimizationLevel > 0 && CodeGenOpts.StrictVTablePointers) {
 // We don't support LTO with 2 with different StrictVTablePointers
 // FIXME: we could support it by stripping all the information introduced

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-projec

r322008 - Revert "Emit Function IDs table for Control Flow Guard"

2018-01-08 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Mon Jan  8 09:12:01 2018
New Revision: 322008

URL: http://llvm.org/viewvc/llvm-project?rev=322008&view=rev
Log:
Revert "Emit Function IDs table for Control Flow Guard"

The new test fails on the Hexagon bot.  Reverting while I investigate.

This reverts https://reviews.llvm.org/rL322005

This reverts commit b7e0026b4385180c378edc658ec91a39566f2942.

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=322008&r1=322007&r2=322008&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Mon Jan  8 09:12:01 2018
@@ -235,8 +235,6 @@ def _SLASH_Fi : CLCompileJoined<"Fi">,
 def _SLASH_Fo : CLCompileJoined<"Fo">,
   HelpText<"Set output object file, or directory (ends in / or \\) (with /c)">,
   MetaVarName<"">;
-def _SLASH_Guard : CLJoined<"guard:">,
-  HelpText<"Enable Control Flow Guard with /guard:cf">;
 def _SLASH_GX : CLFlag<"GX">,
   HelpText<"Enable exception handling">;
 def _SLASH_GX_ : CLFlag<"GX-">,
@@ -366,6 +364,7 @@ def _SLASH_GL_ : CLFlag<"GL-">;
 def _SLASH_Gm : CLFlag<"Gm">;
 def _SLASH_Gm_ : CLFlag<"Gm-">;
 def _SLASH_GT : CLFlag<"GT">;
+def _SLASH_Guard : CLJoined<"guard:">;
 def _SLASH_GZ : CLFlag<"GZ">;
 def _SLASH_H : CLFlag<"H">;
 def _SLASH_homeparams : CLFlag<"homeparams">;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=322008&r1=322007&r2=322008&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Jan  8 09:12:01 2018
@@ -492,8 +492,6 @@ def bind__at__load : Flag<["-"], "bind_a
 def bundle__loader : Separate<["-"], "bundle_loader">;
 def bundle : Flag<["-"], "bundle">;
 def b : JoinedOrSeparate<["-"], "b">, Flags<[Unsupported]>;
-def cfguard : Flag<["-"], "cfguard">, Flags<[CC1Option]>,
-  HelpText<"Emit tables required for Windows Control Flow Guard.">;
 def cl_opt_disable : Flag<["-"], "cl-opt-disable">, Group, 
Flags<[CC1Option]>,
   HelpText<"OpenCL only. This option disables all optimizations. By default 
optimizations are enabled.">;
 def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">, 
Group, Flags<[CC1Option]>,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=322008&r1=322007&r2=322008&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Mon Jan  8 09:12:01 2018
@@ -38,7 +38,6 @@ CODEGENOPT(AssumeSaneOperatorNew , 1, 1)
 CODEGENOPT(Autolink  , 1, 1) ///< -fno-autolink
 CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be 
EH-safe.
 CODEGENOPT(Backchain , 1, 0) ///< -mbackchain
-CODEGENOPT(ControlFlowGuard  , 1, 0) ///< -cfguard
 CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum 
for functions in GCNO files.
 CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function 
names in GCDA files.
 CODEGENOPT(CoverageExitBlockBeforeBody, 1, 0) ///< Whether to emit the exit 
block before the body blocks in GCNO files.

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=322008&r1=322007&r2=322008&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jan  8 09:12:01 2018
@@ -456,10 +456,6 @@ void CodeGenModule::Release() {
 // Indicate that we want CodeView in the metadata.
 getModule().addModuleFlag(llvm::Module::Warning, "CodeView", 1);
   }
-  if (CodeGenOpts.ControlFlowGuard) {
-// We want function ID tables for Control Flow Guard.
-getModule().addModuleFlag(llvm::Module::Warning, "cfguard", 1);
-  }
   if (CodeGenOpts.OptimizationLevel > 0 && CodeGenOpts.StrictVTablePointers) {
 // We don't support LTO with 2 with different StrictVTablePointers
 // FIXME: we could support it by stripping all the information introduced

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=322008&r1=322007&r2=322008&v

r322136 - Reland "Emit Function IDs table for Control Flow Guard"

2018-01-09 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Tue Jan  9 15:49:30 2018
New Revision: 322136

URL: http://llvm.org/viewvc/llvm-project?rev=322136&view=rev
Log:
Reland "Emit Function IDs table for Control Flow Guard"

Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs
of functions that have their address taken into a section named .gfids$y for
compatibility with Microsoft's Control Flow Guard feature.

The original patch didn't have the lit.local.cfg file that restricts the new
test to x86, thus the new test was failing on the non-x86 bots.

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

The reverts r322008, which was a revert of r322005.

This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba.

Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=322136&r1=322135&r2=322136&view=diff
==
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Tue Jan  9 15:49:30 2018
@@ -235,6 +235,8 @@ def _SLASH_Fi : CLCompileJoined<"Fi">,
 def _SLASH_Fo : CLCompileJoined<"Fo">,
   HelpText<"Set output object file, or directory (ends in / or \\) (with /c)">,
   MetaVarName<"">;
+def _SLASH_Guard : CLJoined<"guard:">,
+  HelpText<"Enable Control Flow Guard with /guard:cf">;
 def _SLASH_GX : CLFlag<"GX">,
   HelpText<"Enable exception handling">;
 def _SLASH_GX_ : CLFlag<"GX-">,
@@ -364,7 +366,6 @@ def _SLASH_GL_ : CLFlag<"GL-">;
 def _SLASH_Gm : CLFlag<"Gm">;
 def _SLASH_Gm_ : CLFlag<"Gm-">;
 def _SLASH_GT : CLFlag<"GT">;
-def _SLASH_Guard : CLJoined<"guard:">;
 def _SLASH_GZ : CLFlag<"GZ">;
 def _SLASH_H : CLFlag<"H">;
 def _SLASH_homeparams : CLFlag<"homeparams">;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=322136&r1=322135&r2=322136&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Jan  9 15:49:30 2018
@@ -492,6 +492,8 @@ def bind__at__load : Flag<["-"], "bind_a
 def bundle__loader : Separate<["-"], "bundle_loader">;
 def bundle : Flag<["-"], "bundle">;
 def b : JoinedOrSeparate<["-"], "b">, Flags<[Unsupported]>;
+def cfguard : Flag<["-"], "cfguard">, Flags<[CC1Option]>,
+  HelpText<"Emit tables required for Windows Control Flow Guard.">;
 def cl_opt_disable : Flag<["-"], "cl-opt-disable">, Group, 
Flags<[CC1Option]>,
   HelpText<"OpenCL only. This option disables all optimizations. By default 
optimizations are enabled.">;
 def cl_strict_aliasing : Flag<["-"], "cl-strict-aliasing">, 
Group, Flags<[CC1Option]>,

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=322136&r1=322135&r2=322136&view=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Tue Jan  9 15:49:30 2018
@@ -38,6 +38,7 @@ CODEGENOPT(AssumeSaneOperatorNew , 1, 1)
 CODEGENOPT(Autolink  , 1, 1) ///< -fno-autolink
 CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be 
EH-safe.
 CODEGENOPT(Backchain , 1, 0) ///< -mbackchain
+CODEGENOPT(ControlFlowGuard  , 1, 0) ///< -cfguard
 CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum 
for functions in GCNO files.
 CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function 
names in GCDA files.
 CODEGENOPT(CoverageExitBlockBeforeBody, 1, 0) ///< Whether to emit the exit 
block before the body blocks in GCNO files.

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=322136&r1=322135&r2=322136&view=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Jan  9 15:49:30 2018
@@ -457,6 +457,10 @@ void CodeGenModule::Release() {
 // Indicate that we want CodeView in the metadata.
 getModule().addModuleFlag(llvm::Module::Warning, "CodeView", 1);
   }
+  if (CodeGenOpts.ControlFlowGuard) {
+// We want function ID tables for Control Flow Guard.
+getModule().addModuleFlag(llvm::Module::Warning, "cfguard", 1);
+  }
   if (CodeGenOpts.OptimizationLevel > 0 && CodeGenOpts.S

r313192 - Mark static member functions as static in CodeViewDebug

2017-09-13 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Wed Sep 13 13:53:55 2017
New Revision: 313192

URL: http://llvm.org/viewvc/llvm-project?rev=313192&view=rev
Log:
Mark static member functions as static in CodeViewDebug

Summary:
To improve CodeView quality for static member functions, we need to make the
static explicit.  In addition to a small change in LLVM's CodeViewDebug to
return the appropriate MethodKind, this requires a small change in Clang to
note the staticness in the debug info metadata.

Subscribers: aprantl, hiraditya

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

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=313192&r1=313191&r2=313192&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Sep 13 13:53:55 2017
@@ -1408,6 +1408,8 @@ llvm::DISubprogram *CGDebugInfo::CreateC
 ContainingType = RecordTy;
   }
 
+  if (Method->isStatic())
+Flags |= llvm::DINode::FlagStaticMember;
   if (Method->isImplicit())
 Flags |= llvm::DINode::FlagArtificial;
   Flags |= getAccessFlag(Method->getAccess(), Method->getParent());

Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=313192&r1=313191&r2=313192&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp Wed Sep 13 13:53:55 2017
@@ -6,6 +6,7 @@ struct Foo {
   virtual void f();
   virtual void g();
   virtual void h();
+  static void i(int, int);
   struct Nested {};
 };
 Foo f;
@@ -18,7 +19,7 @@ Foo::Nested n;
 // CHECK-SAME: elements: ![[elements:[0-9]+]]
 // CHECK-SAME: identifier: ".?AUFoo@@"
 
-// CHECK: ![[elements]] = !{![[vshape:[0-9]+]], ![[vptr:[0-9]+]], ![[Nested]], 
![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]]}
+// CHECK: ![[elements]] = !{![[vshape:[0-9]+]], ![[vptr:[0-9]+]], ![[Nested]], 
![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]], ![[i:[0-9]+]]}
 
 // CHECK: ![[vshape]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: 
"__vtbl_ptr_type", baseType: null, size: 96)
 
@@ -38,3 +39,9 @@ Foo::Nested n;
 // CHECK: ![[h]] = !DISubprogram(name: "h",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, 
virtualIndex: 2,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
+
+// CHECK: ![[i]] = !DISubprogram(name: "i",
+// CHECK-SAME: flags: DIFlagPrototyped | DIFlagStaticMember
+// CHECK-NEXT: ![[dummy:[0-9]+]] = !DISubroutineType(types: 
![[Signature:[0-9]+]])
+// CHECK: ![[Signature]] = !{null, ![[BasicInt:[0-9]+]], ![[BasicInt]]}
+// CHECK: ![[BasicInt]] = !DIBasicType(name: "int", size: 32, encoding: 
DW_ATE_signed)


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


[clang] 14dde43 - With MSVC, file needs to be compiled with /BIGOBJ

2020-07-17 Thread Adrian McCarthy via cfe-commits

Author: Adrian McCarthy
Date: 2020-07-17T09:43:06-07:00
New Revision: 14dde438d69c81ab4651157a94d32ee804ff

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

LOG: With MSVC, file needs to be compiled with /BIGOBJ

MSVC, by default, limits the number of sections generated by a single
translation unit to 2^16.  In a debug build, each function or method
can require 4 sections, so it's not uncommon to hit it.

I saw the problem when building tests for LLDB (but, interestingly, not
for LLDB itself).

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

Added: 


Modified: 
clang/lib/ARCMigrate/CMakeLists.txt

Removed: 




diff  --git a/clang/lib/ARCMigrate/CMakeLists.txt 
b/clang/lib/ARCMigrate/CMakeLists.txt
index 6f19bea476da..1d5a185c3b6a 100644
--- a/clang/lib/ARCMigrate/CMakeLists.txt
+++ b/clang/lib/ARCMigrate/CMakeLists.txt
@@ -2,6 +2,12 @@ set(LLVM_LINK_COMPONENTS
   Support
   )
 
+# By default MSVC has a 2^16 limit on the number of sections in an object
+# file, and Transforms.cpp needs more than that.
+if (MSVC)
+  set_source_files_properties(Transforms.cpp PROPERTIES COMPILE_FLAGS /bigobj)
+endif()
+
 add_clang_library(clangARCMigrate
   ARCMT.cpp
   ARCMTActions.cpp



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


Re: [PATCH] D76801: [AST] Print a> without extra spaces in C++11 or later.

2020-04-25 Thread Adrian McCarthy via cfe-commits
I completed the bisect, and it is indeed the change in spacing between the
`>`s that triggers the problem with the visualizers.

That said, I'm still suspicious that the std::map visualizer isn't quite
right with how it uses the wild cards and the template parameter
placeholder(s), but I don't think fixing that makes up for the fact that VS
expects the spaces.

On Thu, Apr 23, 2020 at 11:21 AM Reid Kleckner via Phabricator <
revi...@reviews.llvm.org> wrote:

> rnk added a comment.
>
> Thanks David, I'm comfortable with that stance for DWARF.
>
> I know @amccarth is looking into the recent VS visualizer issue, and I
> would like him to confirm if it was this change or not when he gets a
> chance.
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D76801/new/
>
> https://reviews.llvm.org/D76801
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a549c0d - Fix template class debug info for Visual Studio visualizers

2020-05-13 Thread Adrian McCarthy via cfe-commits

Author: Adrian McCarthy
Date: 2020-05-13T14:20:18-07:00
New Revision: a549c0d00486bf01cb485e343d778fe4a3649a43

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

LOG: Fix template class debug info for Visual Studio visualizers

An earlier change eliminated spaces between the close brackets of nested
template lists.  Unfortunately that prevents the Windows debuggers from
matching some types to their corresponding visualizers (e.g., std::map).

This selects the SeparateTemplateClosers flag when generating CodeView.
Note that we were already making formatting adjustments under similar
circumstances for similar reasons.

This wasn't caught by existing tests because they were using only
-std=c++98.

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

Added: 


Modified: 
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index f92b21d5e636..88ddb44ed762 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -231,9 +231,12 @@ PrintingPolicy CGDebugInfo::getPrintingPolicy() const {
   // If we're emitting codeview, it's important to try to match MSVC's naming 
so
   // that visualizers written for MSVC will trigger for our class names. In
   // particular, we can't have spaces between arguments of standard templates
-  // like basic_string and vector.
-  if (CGM.getCodeGenOpts().EmitCodeView)
+  // like basic_string and vector, but we must have spaces between consecutive
+  // angle brackets that close nested template argument lists.
+  if (CGM.getCodeGenOpts().EmitCodeView) {
 PP.MSVCFormatting = true;
+PP.SplitTemplateClosers = true;
+  }
 
   // Apply -fdebug-prefix-map.
   PP.Callbacks = &PrintCB;

diff  --git a/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp 
b/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
index ab3344bc991c..15f625d8832d 100644
--- a/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
+++ b/clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
@@ -1,11 +1,19 @@
 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
-// RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \
+// RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
 // RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
 // RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview 
-emit-llvm %s \
-// RUN:   -o - -triple=x86_64-pc-win32 -std=c++98 | \
+// RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
 // RUN:grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
 // RUN:FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
+// RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++11 | \
+// RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
+// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
+// RUN:   -o - -triple=x86_64-pc-win32 -Wno-new-returns-null | \
+// RUN:grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: 
"\([^"]*\)".*/"\1"/' | \
+// RUN:FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
 
 void freefunc() { }
 // CHECK-DAG: "freefunc"
@@ -94,5 +102,7 @@ template void fn_tmpl();
 
 template  struct ClassTemplate { A a; B b; 
C c; };
 ClassTemplate > f;
-// This will only show up in normal debug builds.
+// This will only show up in normal debug builds.  The space in `> >` is
+// important for compatibility with Windows debuggers, so it should always be
+// there when generating CodeView.
 // UNQUAL-DAG: "ClassTemplate >"



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


Re: [PATCH] D88666: DirectoryWatcher: add an implementation for Windows

2020-10-13 Thread Adrian McCarthy via cfe-commits
If I had to guess, my money would be on a deadlock.  To unblock, I'd
propose reverting this patch until we can figure it out.

During the review, a deadlock was fixed related to the watcher thread, but
perhaps we missed one for the notifier thread.

On Tue, Oct 13, 2020 at 8:40 AM Hans Wennborg via Phabricator <
revi...@reviews.llvm.org> wrote:

> hans added a comment.
>
> The longer timeout didn't help :(
>
> I'm not sure what's different about the machine where this is failing.
> Maybe it's some filesystem issue due to being a VM?
>
> Any ideas for good printfs or similar that could be added to figure out
> exactly what part is failing?
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D88666/new/
>
> https://reviews.llvm.org/D88666
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D70701: Fix more VFS tests on Windows

2021-01-21 Thread Adrian McCarthy via cfe-commits
 I didn't design VFS.  I just fixed a bunch of portability bugs that
prevented us from running most of the VFS tests on Windows.  If I were
designing it, I (hope) I wouldn't have done it this way.  But the horse is
already out of the barn.

Here's my background with VFS (and, specifically, the redirecting
filesystem):

VFS is used in many tests to map a path in an arbitrary (usually Posix)
style to another path, possibly in a different filesystem.  This allows the
test to be platform agnostic.  For example, the test can refer to
`/foo/bar.h` if it uses the redirecting filesystem to map `/foo` to an
actual directory on the host.  If it's a Windows machine, that target might
be something like `C:\foo`, in which case the actual file would be
`C:\foo\bar.h`, which LLVM thinks of as `C:\foo/bar.h`.  That's inherently
a path with hybrid style.  There are other cases, too, e.g., where the host
is Windows, but the target filesystem is an LLVM in-memory one (which uses
only Posix style).

When I first tried to tackle the portability bugs, I tried various
normalization/canonicalization strategies, but always encountered a
blocker.  That's when rnk pointed out to me that clang generally doesn't do
any path normalization; it just treats paths as strings that can be
concatenated.  With that in mind, I tried accepting the fact that hybrid
path styles are a fact of life in VFS, and suddenly nearly all of the
portability problems became relatively easy to solve.

Note that lots of LLVM and Clang tests were using VFS, but the VFS tests
themselves couldn't run on Windows.  All those tests were built upon
functionality that wasn't being tested.

I think that we probably could do something simpler, but it would force a
breaking change in the design of the redirecting filesystem.  The most
obvious victim of that break would be various LLVM and clang tests that
exclusively use Posix-style paths and rely on VFS to make it work on
non-Posix OSes.  I'm not sure how significant the break would be for others.

Looking specifically at your proposal:

> - The path style is detected when reading the YAML file (as now).

Which path's style?  The virtual one that's going to be redirected or the
actual one it's redirected at?

- Paths in the YAML file are canonicalized to native at parse time.

If we canonicalize the virtual path, VFS would no longer be valuable for
creating platform-agnostic tests.

I don't remember the details, but canonicalizing the target paths caused
problems.  Do we need to be careful about multiple redirections (e.g.,
`/foo` directs to `/zerz` which directs to `C:\bumble`)?  I seem to recall
there was a good reason why the redirecting filesystem waits to the last
moment to convert a virtual path to an actual host path.

> - The nodes in-memory all use native paths so the non-native style isn't
needed after construction is complete.

I'm guessing that would affect how paths are displayed (e.g., in diagnostic
messages).  At a minimum, we'd have to fix some tests.  I don't know all
the contexts this might occur and how that might affect things.  For
example, paths may be written into debug info metadata.

- `makeAbsolute()` doesn't need to be overridden / special.

Honestly, I'm not sure we have a good definition of what `makeAbsolute`
should do.  Sure, on Posix, it's well understood.  But is `\foo` an
absolute path on Windows?  Is `D:bar.h` an absolute path on Windows?  If
not, how should those be made absolute?  LLVM assumes that there's a well
defined mapping between Posix filesystem concepts and the host filesystem.
But I haven't seen any documentation on how a Posix->Windows mapping should
work (let alone the inverse), and I certainly don't have an intuitive
understanding of how that mapping should work.

In LLDB, we have the additional wrinkle of remote debugging, where the
debugger may be running on a Windows machine while the program being
debugged is running on a Linux box.  You always have to know whether a path
will be used on the debugger host or the debuggee host.  And there are
similar concerns for post-mortem debugging from a crash collected on a
different type of host.

I'm not opposed to making this better, but I don't think I understand your
proposal well enough to discuss it in detail.  I'm pretty sure anything
that eliminates hybrid paths is going to cause some breaking changes.  That
might be as simple as fixing up a bunch of tests, but it might have wider
impact.

Adrian.

On Thu, Jan 21, 2021 at 4:26 PM Duncan P. N. Exon Smith via Phabricator <
revi...@reviews.llvm.org> wrote:

> dexonsmith added a comment.
>
> @rnk / @amccarth, I've been looking at the history of `makeAbsolute` being
> virtual, since it's a bit awkward that `RedirectingFileSystem` behaves
> differently from the others. I'm hoping you can give me a bit more context.
>
> I'm wondering about an alternative implementation where:
>
> - The path style is detected when reading the YAML file (as now).
> - Paths in the YAML file are can

Re: [PATCH] D70701: Fix more VFS tests on Windows

2021-01-22 Thread Adrian McCarthy via cfe-commits
BTW, I hope I didn't come across as overly negative in my previous
response.  I'd love to see the situation improved.  I just don't know what
that would look like.

> One thing I see, but wasn't obvious from your description, is that the
mixed/hybrid separator behaviour only happens for `defined(_WIN_32)`.
> [copy of `is_separator` elided]

It's a runtime decision based on the specified style, not a compile-time
one based on _WIN_32.  If the caller of `is_separator` passes
`Style::windows` then it'll accept either `/` or `\\`, even if LLVM was
compiled and run on Linux or Mac.  I believe there's a VFS test that
redirects a Windows-style path to a Posix-style one (an in-memory file
system), and that test passes on both kinds of hosts.

But I get the gist of the point.  My feeling is that, unless we can
eliminate hybrid styles, Paths should support a Style::hybrid.  It would be
messy because more ambiguities about how to map things crop up.

> Honestly, I'm not sure we have a good definition of what makeAbsolute
> should do.

I should have said:  **I** don't have a good understanding of what
makeAbsolute should do.  Even saying it should prepend the current working
directory is an incomplete answer.  On Windows, a process can have multiple
current directories:  one for each drive.  And a process has one current
drive.  So the current working directory is the current directory for the
current drive.  A Windows path like "D:foo.txt" is a relative path.
Literally prepending the current working directory gives us
`C:\users\me\D:foo.txt`, which is syntactically wrong.  But even if we're
smart enough to fix up the syntax, we'd get `C:\users\me\foo.txt` or
`D:\users\me\foo.txt`, both of which would (likely) be wrong.  The way the
OS would resolve it is to look up the process's current directory for the
D: drive, and insert that into the missing bit.

Anyway, I look forward to any and all proposals to improve this situation.


On Thu, Jan 21, 2021 at 6:47 PM Duncan P. N. Exon Smith via Phabricator <
revi...@reviews.llvm.org> wrote:

> dexonsmith added a comment.
>
> Thanks for the quick and detailed response!
>
> Your explanation of hybrid behaviour on Windows was especially helpful, as
> I didn't fully understand how that worked before.
>
> One thing I see, but wasn't obvious from your description, is that the
> mixed/hybrid separator behaviour only happens for `defined(_WIN_32)`. E.g.,
> from Path.cpp:
>
>   bool is_separator(char value, Style style) {
> if (value == '/')
>   return true;
> if (real_style(style) == Style::windows)
>   return value == '\\';
> return false;
>   }
>
>
>
> In D70701#2514143 , @amccarth
> wrote:
>
> >> - The path style is detected when reading the YAML file (as now).
> >
> > Which path's style?  The virtual one that's going to be redirected or the
> > actual one it's redirected at?
>
> Both, but you've mostly convinced me not to go down this route.
>
> > - Paths in the YAML file are canonicalized to native at parse time.
> >
> > If we canonicalize the virtual path, VFS would no longer be valuable for
> > creating platform-agnostic tests.
>
> This is a good point I hadn't considered.
>
> > In LLDB, we have the additional wrinkle of remote debugging, where the
> > debugger may be running on a Windows machine while the program being
> > debugged is running on a Linux box.  You always have to know whether a
> path
> > will be used on the debugger host or the debuggee host.  And there are
> > similar concerns for post-mortem debugging from a crash collected on a
> > different type of host.
>
> Ah, interesting.
>
> > Honestly, I'm not sure we have a good definition of what makeAbsolute
> > should do.
>
> Perhaps the name isn't ideal --
> `prependRelativePathsWithCurrentWorkingDirectory()` would be more precise
> -- but otherwise I'm not sure I fully agree. Regardless, I acknowledge your
> point that the two worlds are awkwardly different.
>
> I'm going to think about other options; thanks again for your feedback. I
> am still leaning toward `FileSystem::makeAbsolute()` not being virtual /
> overridden, but I have a better idea of how to approach that. One idea is
> for the `RedirectingFileSystem` to keep track of where different styles
> were used when parsing I'm not sure if that'll pan out though.
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D70701/new/
>
> https://reviews.llvm.org/D70701
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1275ab1 - Improve VFS compatibility on Windows

2019-11-14 Thread Adrian McCarthy via cfe-commits

Author: Adrian McCarthy
Date: 2019-11-14T08:48:47-08:00
New Revision: 1275ab1620b665eb06231ce3c4e5068c97d9b618

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

LOG: Improve VFS compatibility on Windows

Keys in a virtual file system can be in Posix or Windows form or even
a combination of the two.  Many VFS tests (and a few Clang tests) were
XFAILed on Windows because of false negatives when comparing paths.

First, we default CaseSenstive to false on Windows.  This allows
drive letters like "D:" to match "d:".  Windows filesystems are, by
default, case insensitive, so this makes sense even beyond the drive
letter.

Second, we allow slashes to match backslashes when they're used as the
root component of a path.

Both of these changes are limited to RedirectingFileSystems, so there's
little chance of affecting other path handling.

These changes allow eleven of the VFS tests to pass on Windows as well
as three other Clang tests, so they have re-enabled.

This solves the majority of PR43272.  Additional VFS test failures will
be fixed in separate patches.

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

Added: 


Modified: 
clang/test/Index/index-module-with-vfs.m
clang/test/Modules/double-quotes.m
clang/test/Modules/framework-public-includes-private.m
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/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/VirtualFileSystem.cpp

Removed: 




diff  --git a/clang/test/Index/index-module-with-vfs.m 
b/clang/test/Index/index-module-with-vfs.m
index a1c74cfd8de0..46fa68dfa130 100644
--- a/clang/test/Index/index-module-with-vfs.m
+++ b/clang/test/Index/index-module-with-vfs.m
@@ -1,6 +1,3 @@
-// FIXME: PR43272
-// XFAIL: system-windows
-
 @import ModuleNeedsVFS;
 
 void foo() {
@@ -13,7 +10,7 @@ void foo() {
 // RUN: c-index-test -index-file %s -fmodules-cache-path=%t.cache -fmodules -F 
%t -I %t \
 // RUN:  -ivfsoverlay %t.yaml -Xclang -fdisable-module-hash | 
FileCheck %s
 
-// CHECK: [importedASTFile]: {{.*}}ModuleNeedsVFS.pcm | loc: 4:1 | name: 
"ModuleNeedsVFS" | isImplicit: 0
+// CHECK: [importedASTFile]: {{.*}}ModuleNeedsVFS.pcm | loc: 1:1 | name: 
"ModuleNeedsVFS" | isImplicit: 0
 // CHECK: [indexEntityReference]: kind: function | name: module_needs_vfs
 // CHECK: [indexEntityReference]: kind: function | name: base_module_needs_vfs
 

diff  --git a/clang/test/Modules/double-quotes.m 
b/clang/test/Modules/double-quotes.m
index bed6a48726b5..4ce712ccc6c5 100644
--- a/clang/test/Modules/double-quotes.m
+++ b/clang/test/Modules/double-quotes.m
@@ -1,6 +1,3 @@
-// FIXME: PR43272
-// XFAIL: system-windows
-
 // RUN: rm -rf %t
 // RUN: mkdir %t
 

diff  --git a/clang/test/Modules/framework-public-includes-private.m 
b/clang/test/Modules/framework-public-includes-private.m
index be9223016baf..0f1e3a242a15 100644
--- a/clang/test/Modules/framework-public-includes-private.m
+++ b/clang/test/Modules/framework-public-includes-private.m
@@ -1,6 +1,3 @@
-// FIXME: PR43272
-// XFAIL: system-windows
-
 // RUN: rm -rf %t
 // RUN: mkdir %t
 

diff  --git a/clang/test/VFS/external-names.c b/clang/test/VFS/external-names.c
index 569c226c8684..1e12c930c35e 100644
--- a/clang/test/VFS/external-names.c
+++ b/clang/test/VFS/external-names.c
@@ -1,9 +1,6 @@
 // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" -e 
"s@EXTERNAL_NAMES@true@" %S/Inputs/use-external-names.yaml > %t.external.yaml
 // RUN: sed -e "s@INPUT_DIR@%/S/Inputs@g" -e "s@OUT_DIR@%/t@g" -e 
"s@EXTERNAL_NAMES@false@" %S/Inputs/use-external-names.yaml > %t.yaml
 
-// FIXME: PR43272
-// XFAIL: system-windows
-
 #include "external-names.h"
 #ifdef REINCLUDE
 #include "external-names.h"

diff  --git a/clang/test/VFS/framework-import.m 
b/clang/test/VFS/framework-import.m
index 231a3884bb9e..858f1f57fbd1 100644
--- a/clang/test/VFS/framework-import.m
+++ b/clang/test/VFS/framework-import.m
@@ -1,9 +1,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 -F %t -ivfsoverlay %t.yaml -fsyntax-only %s
 
-// FIXME: PR43272
-// XFAIL: system-windows
-
 #import 
 
 void foo() {

diff  --git a/clang/test/VFS/implicit-include.c 
b/clang/test/VFS/implicit-include.c
index 39187417925e..654e0a87de0e 100644
--- a/clang/test/VFS/im

[clang] 9d38fd8 - [NFC] Update FIXME for one VFS test

2019-12-18 Thread Adrian McCarthy via cfe-commits

Author: Adrian McCarthy
Date: 2019-12-18T11:38:04-08:00
New Revision: 9d38fd8d0be3074af036e9e3e36489f5b854faf4

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

LOG: [NFC] Update FIXME for one VFS test

The VFS/subframework-symlink.m test is still XFAIL on Windows, but for
a different reason than those fixed in PR43272, so I've updated the
PR number.

Added: 


Modified: 
clang/test/VFS/subframework-symlink.m

Removed: 




diff  --git a/clang/test/VFS/subframework-symlink.m 
b/clang/test/VFS/subframework-symlink.m
index 68cc063cfcfc..77e8572aa457 100644
--- a/clang/test/VFS/subframework-symlink.m
+++ b/clang/test/VFS/subframework-symlink.m
@@ -1,4 +1,4 @@
-// FIXME: PR43272
+// FIXME: PR44221
 // XFAIL: system-windows
 
 // Test that when a subframework is a symlink to another framework, we don't



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


[clang] 738b5c9 - Fix more VFS tests on Windows

2019-12-18 Thread Adrian McCarthy via cfe-commits

Author: Adrian McCarthy
Date: 2019-12-18T11:38:04-08:00
New Revision: 738b5c9639b4323f75b03e21494bef13d9adfa86

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

LOG: Fix more VFS tests on Windows

Since VFS paths can be in either Posix or Windows style, we have to use
a more flexible definition of "absolute" path.

The key here is that FileSystem::makeAbsolute is now virtual, and the
RedirectingFileSystem override checks for either concept of absolute
before trying to make the path absolute by combining it with the current
directory.

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

Added: 


Modified: 
clang/test/VFS/vfsroot-include.c
clang/test/VFS/vfsroot-module.m
clang/test/VFS/vfsroot-with-overlay.c
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/VirtualFileSystem.cpp

Removed: 




diff  --git a/clang/test/VFS/vfsroot-include.c 
b/clang/test/VFS/vfsroot-include.c
index 2564004ea4b1..eb641c58a650 100644
--- a/clang/test/VFS/vfsroot-include.c
+++ b/clang/test/VFS/vfsroot-include.c
@@ -1,6 +1,3 @@
-// FIXME: PR43272
-// XFAIL: system-windows
-
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: sed -e "s@TEST_DIR@%{/S:regex_replacement}@g" -e 
"s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/vfsroot.yaml > %t.yaml

diff  --git a/clang/test/VFS/vfsroot-module.m b/clang/test/VFS/vfsroot-module.m
index 3ad3e19d4b37..787e2f513c55 100644
--- a/clang/test/VFS/vfsroot-module.m
+++ b/clang/test/VFS/vfsroot-module.m
@@ -1,6 +1,3 @@
-// FIXME: PR43272
-// XFAIL: system-windows
-
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: sed -e "s@TEST_DIR@%{/S:regex_replacement}@g" -e 
"s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/vfsroot.yaml > %t.yaml

diff  --git a/clang/test/VFS/vfsroot-with-overlay.c 
b/clang/test/VFS/vfsroot-with-overlay.c
index 4a2c64cb8734..d181f4d8382c 100644
--- a/clang/test/VFS/vfsroot-with-overlay.c
+++ b/clang/test/VFS/vfsroot-with-overlay.c
@@ -1,6 +1,3 @@
-// FIXME: PR43272
-// XFAIL: system-windows
-
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
 // RUN: sed -e "s@TEST_DIR@%{/S:regex_replacement}@g" -e 
"s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/vfsroot.yaml > %t.yaml

diff  --git a/llvm/include/llvm/Support/VirtualFileSystem.h 
b/llvm/include/llvm/Support/VirtualFileSystem.h
index 3b4c4aff9bdc..e45e6e756786 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -293,7 +293,7 @@ class FileSystem : public 
llvm::ThreadSafeRefCountedBase {
   /// \param Path A path that is modified to be an absolute path.
   /// \returns success if \a path has been made absolute, otherwise a
   ///  platform-specific error_code.
-  std::error_code makeAbsolute(SmallVectorImpl &Path) const;
+  virtual std::error_code makeAbsolute(SmallVectorImpl &Path) const;
 };
 
 /// Gets an \p vfs::FileSystem for the 'real' file system, as seen by
@@ -749,6 +749,8 @@ class RedirectingFileSystem : public vfs::FileSystem {
 
   std::error_code isLocal(const Twine &Path, bool &Result) override;
 
+  std::error_code makeAbsolute(SmallVectorImpl &Path) const override;
+
   directory_iterator dir_begin(const Twine &Dir, std::error_code &EC) override;
 
   void setExternalContentsPrefixDir(StringRef PrefixDir);

diff  --git a/llvm/lib/Support/VirtualFileSystem.cpp 
b/llvm/lib/Support/VirtualFileSystem.cpp
index 2d5c04baa57e..edd4234fe501 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -1073,6 +1073,19 @@ std::error_code RedirectingFileSystem::isLocal(const 
Twine &Path,
   return ExternalFS->isLocal(Path, Result);
 }
 
+std::error_code RedirectingFileSystem::makeAbsolute(SmallVectorImpl 
&Path) const {
+  if (llvm::sys::path::is_absolute(Path, llvm::sys::path::Style::posix) ||
+  llvm::sys::path::is_absolute(Path, llvm::sys::path::Style::windows))
+return {};
+
+  auto WorkingDir = getCurrentWorkingDirectory();
+  if (!WorkingDir)
+return WorkingDir.getError();
+
+  llvm::sys::fs::make_absolute(WorkingDir.get(), Path);
+  return {};
+}
+
 directory_iterator RedirectingFileSystem::dir_begin(const Twine &Dir,
 std::error_code &EC) {
   ErrorOr E = lookupPath(Dir);
@@ -1428,21 +1441,31 @@ class llvm::vfs::RedirectingFileSystemParser {
   return nullptr;
 }
 
-if (IsRootEntry && !sys::path::is_absolute(Name)) {
-  assert(NameValueNode && "Name presence should be checked earlier");
-  error(NameValueNode,
-"entry with relative path at the root level is not discoverable");
-  return nullptr;
+sys::path::Style path_style = sys::path::Style::native;
+if (IsRootEntry) {
+  // VFS root entries may be in either Posix or Windows style.  Figure out
+   

[clang] da45bd2 - [VFS] More consistent support for Windows

2020-02-05 Thread Adrian McCarthy via cfe-commits

Author: Adrian McCarthy
Date: 2020-02-05T11:38:20-08:00
New Revision: da45bd232165eab5d6ec4f1f4f18db8644289142

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

LOG: [VFS] More consistent support for Windows

Removed some #ifdefs specific to Windows handling of VFS paths.  This
eliminates most of the differences between the Windows and non-Windows
code paths.

Making this work required some changes to account for the fact that VFS
file paths can be Posix style or Windows style, so you cannot just assume
that they use the host's native path style.  In one case, this means
implementing our own version of make_absolute, since the filesystem code
in Support doesn't have styles in the sense that the path code does.

Differential Review: https://reviews.llvm.org/D71092

Added: 


Modified: 
clang/test/VFS/external-names.c
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/VirtualFileSystem.cpp
llvm/unittests/Support/VirtualFileSystemTest.cpp

Removed: 




diff  --git a/clang/test/VFS/external-names.c b/clang/test/VFS/external-names.c
index 7e24b5fdf063..c50d240a32eb 100644
--- a/clang/test/VFS/external-names.c
+++ b/clang/test/VFS/external-names.c
@@ -10,7 +10,7 @@
 // Preprocessor (__FILE__ macro and # directives):
 
 // RUN: %clang_cc1 -I %t -ivfsoverlay %t.external.yaml -E %s | FileCheck 
-check-prefix=CHECK-PP-EXTERNAL %s
-// CHECK-PP-EXTERNAL: # {{[0-9]*}} "[[NAME:.*Inputs.external-names.h]]"
+// CHECK-PP-EXTERNAL: # {{[0-9]*}} "[[NAME:.*Inputs(/|)external-names.h]]"
 // CHECK-PP-EXTERNAL-NEXT: void foo(char **c) {
 // CHECK-PP-EXTERNAL-NEXT: *c = "[[NAME]]";
 

diff  --git a/llvm/include/llvm/Support/VirtualFileSystem.h 
b/llvm/include/llvm/Support/VirtualFileSystem.h
index e45e6e756786..9b8d0574f008 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -705,16 +705,6 @@ class RedirectingFileSystem : public vfs::FileSystem {
   bool IsFallthrough = true;
   /// @}
 
-  /// Virtual file paths and external files could be canonicalized without 
"..",
-  /// "." and "./" in their paths. FIXME: some unittests currently fail on
-  /// win32 when using remove_dots and remove_leading_dotslash on paths.
-  bool UseCanonicalizedPaths =
-#ifdef _WIN32
-  false;
-#else
-  true;
-#endif
-
   RedirectingFileSystem(IntrusiveRefCntPtr ExternalFS);
 
   /// Looks up the path [Start, End) in \p From, possibly

diff  --git a/llvm/lib/Support/VirtualFileSystem.cpp 
b/llvm/lib/Support/VirtualFileSystem.cpp
index 321ce144b675..737116ce5ad2 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -990,6 +990,28 @@ std::error_code InMemoryFileSystem::isLocal(const Twine 
&Path, bool &Result) {
 // RedirectingFileSystem implementation
 
//===---===/
 
+namespace {
+
+/// Removes leading "./" as well as path components like ".." and ".".
+static llvm::SmallString<256> canonicalize(llvm::StringRef Path) {
+  // First detect the path style in use by checking the first separator.
+  llvm::sys::path::Style style = llvm::sys::path::Style::native;
+  const size_t n = Path.find_first_of("/\\");
+  if (n != static_cast(-1))
+style = (Path[n] == '/') ? llvm::sys::path::Style::posix
+ : llvm::sys::path::Style::windows;
+
+  // Now remove the dots.  Explicitly specifying the path style prevents the
+  // direction of the slashes from changing.
+  llvm::SmallString<256> result =
+  llvm::sys::path::remove_leading_dotslash(Path, style);
+  llvm::sys::path::remove_dots(result, /*remove_dot_dot=*/true, style);
+  return result;
+}
+
+} // anonymous namespace
+
+
 RedirectingFileSystem::RedirectingFileSystem(IntrusiveRefCntPtr FS)
 : ExternalFS(std::move(FS)) {
   if (ExternalFS)
@@ -1083,7 +1105,23 @@ std::error_code 
RedirectingFileSystem::makeAbsolute(SmallVectorImpl &Path)
   if (!WorkingDir)
 return WorkingDir.getError();
 
-  llvm::sys::fs::make_absolute(WorkingDir.get(), Path);
+  // We can't use sys::fs::make_absolute because that assumes the path style
+  // is native and there is no way to override that.  Since we know WorkingDir
+  // is absolute, we can use it to determine which style we actually have and
+  // append Path ourselves.
+  sys::path::Style style = sys::path::Style::windows;
+  if (sys::path::is_absolute(WorkingDir.get(), sys::path::Style::posix)) {
+style = sys::path::Style::posix;
+  }
+
+  std::string Result = WorkingDir.get();
+  StringRef Dir(Result);
+  if (!Dir.endswith(sys::path::get_separator(style))) {
+Result += sys::path::get_separator(style);
+  }
+  Result.append(Path.data(), Path.size());
+  Path.assign(Result.begin(), Resul

Re: [PATCH] D23462: Emit debug info for dynamic classes if they are imported from a DLL

2016-08-15 Thread Adrian McCarthy via cfe-commits
amccarth updated this revision to Diff 68114.
amccarth added a comment.

Added a test.


https://reviews.llvm.org/D23462

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-dllimport-base-class.cpp

Index: test/CodeGenCXX/debug-info-dllimport-base-class.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-dllimport-base-class.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i386-pc-windows -emit-llvm -gcodeview 
-debug-info-kind=limited -fms-compatibility %s -x c++ -o - | FileCheck %s
+
+// Ensure we emit debug info for the full definition of base classes that will
+// be imported from a DLL.  Otherwise, the debugger wouldn't be able to show 
the
+// members.
+
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ImportedBase",
+// CHECK-NOT:  DIFlagFwdDecl
+// CHECK-SAME: ){{$}}
+
+struct __declspec(dllimport) ImportedBase {
+  ImportedBase();
+  virtual void Foo();
+};
+
+struct DerivedFromImported : public ImportedBase {};
+
+int main() {
+  DerivedFromImported d;
+}
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1685,7 +1685,8 @@
   if (!CXXDecl)
 return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;


Index: test/CodeGenCXX/debug-info-dllimport-base-class.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-dllimport-base-class.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i386-pc-windows -emit-llvm -gcodeview -debug-info-kind=limited -fms-compatibility %s -x c++ -o - | FileCheck %s
+
+// Ensure we emit debug info for the full definition of base classes that will
+// be imported from a DLL.  Otherwise, the debugger wouldn't be able to show the
+// members.
+
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ImportedBase",
+// CHECK-NOT:  DIFlagFwdDecl
+// CHECK-SAME: ){{$}}
+
+struct __declspec(dllimport) ImportedBase {
+  ImportedBase();
+  virtual void Foo();
+};
+
+struct DerivedFromImported : public ImportedBase {};
+
+int main() {
+  DerivedFromImported d;
+}
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1685,7 +1685,8 @@
   if (!CXXDecl)
 return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23462: Emit debug info for dynamic classes if they are imported from a DLL

2016-08-15 Thread Adrian McCarthy via cfe-commits
amccarth added a comment.

Thank, dblaikie, for correcting my terminology.


https://reviews.llvm.org/D23462



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


Re: [PATCH] D23462: Emit debug info for dynamic classes if they are imported from a DLL

2016-08-16 Thread Adrian McCarthy via cfe-commits
amccarth updated this revision to Diff 68225.
amccarth added a comment.

Add comment as requested.


https://reviews.llvm.org/D23462

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGenCXX/debug-info-dllimport-base-class.cpp

Index: test/CodeGenCXX/debug-info-dllimport-base-class.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-dllimport-base-class.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i386-pc-windows -emit-llvm -gcodeview 
-debug-info-kind=limited -fms-compatibility %s -x c++ -o - | FileCheck %s
+
+// Ensure we emit debug info for the full definition of base classes that will
+// be imported from a DLL.  Otherwise, the debugger wouldn't be able to show 
the
+// members.
+
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ImportedBase",
+// CHECK-NOT:  DIFlagFwdDecl
+// CHECK-SAME: ){{$}}
+
+struct __declspec(dllimport) ImportedBase {
+  ImportedBase();
+  virtual void Foo();
+};
+
+struct DerivedFromImported : public ImportedBase {};
+
+int main() {
+  DerivedFromImported d;
+}
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1685,7 +1685,12 @@
   if (!CXXDecl)
 return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  // Only emit complete debug info for a dynamic class when its vtable is
+  // emitted.  However, Microsoft debuggers don't resolve type information
+  // across DLL boundaries, so skip this optimization if the class is marked
+  // dllimport.
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;


Index: test/CodeGenCXX/debug-info-dllimport-base-class.cpp
===
--- /dev/null
+++ test/CodeGenCXX/debug-info-dllimport-base-class.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i386-pc-windows -emit-llvm -gcodeview -debug-info-kind=limited -fms-compatibility %s -x c++ -o - | FileCheck %s
+
+// Ensure we emit debug info for the full definition of base classes that will
+// be imported from a DLL.  Otherwise, the debugger wouldn't be able to show the
+// members.
+
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ImportedBase",
+// CHECK-NOT:  DIFlagFwdDecl
+// CHECK-SAME: ){{$}}
+
+struct __declspec(dllimport) ImportedBase {
+  ImportedBase();
+  virtual void Foo();
+};
+
+struct DerivedFromImported : public ImportedBase {};
+
+int main() {
+  DerivedFromImported d;
+}
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1685,7 +1685,12 @@
   if (!CXXDecl)
 return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  // Only emit complete debug info for a dynamic class when its vtable is
+  // emitted.  However, Microsoft debuggers don't resolve type information
+  // across DLL boundaries, so skip this optimization if the class is marked
+  // dllimport.
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23462: Emit debug info for dynamic classes if they are imported from a DLL

2016-08-16 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/CodeGen/CGDebugInfo.cpp:1688-1689
@@ -1687,3 +1687,4 @@
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;

rnk wrote:
> David, since we're doing this check to work around a limitation of PDB-based 
> debuggers, do you think we should guard check with EmitCodeView, so that we 
> don't emit the full type if we're emitting DWARF?
> 
> After that, I'd add a comment like:
>   // Only emit complete debug info for a dynamic class when its vtable is 
> emitted. However,
>   // Microsoft debuggers are unable to resolve type information across DLL 
> boundaries,
>   // so skip this optimization if the class is marked dllimport.
Comment added.

I don't think the EmitCodeView check is necessary because it seems unlikely the 
DLLImportAttr would be set with DWARF debug info, and, even if it is, I 
wouldn't expect it to do any harm.  But I'll defer to dblaikie or other DWARF 
experts.


https://reviews.llvm.org/D23462



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


r278861 - Emit debug info for dynamic classes if they are imported from a DLL.

2016-08-16 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Tue Aug 16 17:11:18 2016
New Revision: 278861

URL: http://llvm.org/viewvc/llvm-project?rev=278861&view=rev
Log:
Emit debug info for dynamic classes if they are imported from a DLL.

With -debug-info-kind=limited, we omit debug info for dynamic classes that live 
in other TUs. This reduces duplicate type information. When statically linked, 
the type information comes together. But if your binary has a class derived 
from a base in a DLL, the base class info is not available to the debugger.

The decision is made in shouldOmitDefinition (CGDebugInfo.cpp). Per a 
suggestion from rnk, I've tweaked the decision so that we do include 
definitions for classes marked as DLL imports. This should be a relatively 
small number of classes, so we don't pay a large price for duplication of the 
type info, yet it should cover most cases on Windows.

Essentially this makes debug info for DLLs independent, but we still assume 
that all TUs within the same DLL will be consistently built with (or without) 
debug info and the debugger will be able to search across the debug info within 
that scope to resolve any declarations into definitions, etc.

Added:
cfe/trunk/test/CodeGenCXX/debug-info-dllimport-base-class.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=278861&r1=278860&r2=278861&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Aug 16 17:11:18 2016
@@ -1685,7 +1685,12 @@ static bool shouldOmitDefinition(codegen
   if (!CXXDecl)
 return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  // Only emit complete debug info for a dynamic class when its vtable is
+  // emitted.  However, Microsoft debuggers don't resolve type information
+  // across DLL boundaries, so skip this optimization if the class is marked
+  // dllimport.
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;

Added: cfe/trunk/test/CodeGenCXX/debug-info-dllimport-base-class.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dllimport-base-class.cpp?rev=278861&view=auto
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dllimport-base-class.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dllimport-base-class.cpp Tue Aug 16 
17:11:18 2016
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i386-pc-windows -emit-llvm -gcodeview 
-debug-info-kind=limited -fms-compatibility %s -x c++ -o - | FileCheck %s
+
+// Ensure we emit debug info for the full definition of base classes that will
+// be imported from a DLL.  Otherwise, the debugger wouldn't be able to show 
the
+// members.
+
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ImportedBase",
+// CHECK-NOT:  DIFlagFwdDecl
+// CHECK-SAME: ){{$}}
+
+struct __declspec(dllimport) ImportedBase {
+  ImportedBase();
+  virtual void Foo();
+};
+
+struct DerivedFromImported : public ImportedBase {};
+
+int main() {
+  DerivedFromImported d;
+}


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


Re: [PATCH] D23462: Emit debug info for dynamic classes if they are imported from a DLL

2016-08-16 Thread Adrian McCarthy via cfe-commits
amccarth closed this revision.
amccarth added a comment.

Closed by r278861


https://reviews.llvm.org/D23462



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


[PATCH] D23720: Omit column info for CodeView by default

2016-08-19 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a subscriber: cfe-commits.

Clang tracks only start columns, not start-end ranges.  CodeView allows for 
that, but the VS debugger doesn't handle anything less than a complete range 
well--it either highlights the wrong part of a statement or truncates source 
lines in the assembly view.  It's better to have no column information at all.

So by default, we'll omit the column information for CodeView targeting Windows.

Since the column info is still useful for sanitizers, I've promoted 
-gcolumn-info (and -gno-column-info) to a CoreOption and added a couple tests 
to make sure that works for clang-cl.

https://reviews.llvm.org/D23720

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  test/Driver/cl-options.c

Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -50,6 +50,15 @@
 // fpstrict-NOT: -menable-unsafe-fp-math
 // fpstrict-NOT: -ffast-math
 
+// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck 
-check-prefix=gcolumn %s
+// gcolumn: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck 
-check-prefix=gnocolumn %s
+// gnocolumn-NOT: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
+// gdefcolumn-NOT: -dwarf-column-info
+
 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
 // GA: -ftls-model=local-exec
 
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2574,7 +2574,7 @@
   case llvm::Triple::wasm32:
   case llvm::Triple::wasm64:
 getWebAssemblyTargetFeatures(Args, Features);
-break; 
+break;
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel:
   case llvm::Triple::sparcv9:
@@ -4627,9 +4627,13 @@
   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
   Args.ClaimAllArgs(options::OPT_g_flags_Group);
 
-  // PS4 defaults to no column info
+  // Column info is included by default for everything except PS4 and CodeView.
+  // Clang doesn't track end columns, just starting columns, which, in theory,
+  // is fine for CodeView (and PDB).  In practice, however, the Microsoft
+  // debuggers don't handle missing end columns well, so it's better not to
+  // include any column info.
   if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
-   /*Default=*/ !IsPS4CPU))
+   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC && EmitCodeView)))
 CmdArgs.push_back("-dwarf-column-info");
 
   // FIXME: Move backend command line options to the module.
@@ -6675,7 +6679,7 @@
   case llvm::Triple::mips64el:
 AddMIPSTargetArgs(Args, CmdArgs);
 break;
-
+
   case llvm::Triple::x86:
   case llvm::Triple::x86_64:
 AddX86TargetArgs(Args, CmdArgs);
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1298,8 +1298,8 @@
   Group;
 def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
 def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group;
-def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
-def gno_column_info : Flag<["-"], "gno-column-info">, Group;
+def gcolumn_info : Flag<["-"], "gcolumn-info">, Group, 
Flags<[CoreOption]>;
+def gno_column_info : Flag<["-"], "gno-column-info">, Group, 
Flags<[CoreOption]>;
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;


Index: test/Driver/cl-options.c
===
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -50,6 +50,15 @@
 // fpstrict-NOT: -menable-unsafe-fp-math
 // fpstrict-NOT: -ffast-math
 
+// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s
+// gcolumn: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s
+// gnocolumn-NOT: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
+// gdefcolumn-NOT: -dwarf-column-info
+
 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
 // GA: -ftls-model=local-exec
 
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2574,7 +2574,7 @@
   case llvm::Triple::wasm32:
   case llvm::Triple::wasm64:
 getWebAssemblyTargetFeatures(Args, Features);
-break; 
+break;
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel:
   case llvm::Triple::sparcv9:
@@ -4627,9 +4627,13 @@
   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
   Args.ClaimAllArgs(opt

Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-24 Thread Adrian McCarthy via cfe-commits
amccarth added a comment.

I don't know enough C# to review for language usage.  I was mostly reading for 
understandability.  Overall, I think this looks really nice.



Comment at: clang-tidy-vs/ClangTidy/CheckTree.cs:67
@@ +66,3 @@
+if (ParentPath == null)
+return Name_;
+return ParentPath + "-" + Name_;

This seems overly complicated so I assume I'm missing some nuance.  Why not:

if (Parent_ == null)
return Name_;
string ParentPath = Parent_.Path;

Is there a case where Parent_.Path could return null besides the one that you 
created?




Comment at: clang-tidy-vs/ClangTidy/InheritablePropertyComponent.cs:14
@@ +13,3 @@
+/// have properties which might inherit from their parent, or be 
overridden.
+/// It turns out this is somewhat non-trivial.  The .NET PropertyGrid is 
good makes
+/// displaying simple properties with a static notion of what constitutes a

s/good makes/makes/



Comment at: clang-tidy-vs/README.txt:8
@@ +7,3 @@
+- Visual Studio 2010 Professional (?)
+- Visual Studio 2010 SDK (?)
+

2010?  2015?  Will Community editions work?


https://reviews.llvm.org/D23848



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


r279765 - Omit column info for CodeView by default

2016-08-25 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Thu Aug 25 13:24:35 2016
New Revision: 279765

URL: http://llvm.org/viewvc/llvm-project?rev=279765&view=rev
Log:
Omit column info for CodeView by default

Clang tracks only start columns, not start-end ranges. CodeView allows for 
that, but the VS debugger doesn't handle anything less than a complete range 
well--it either highlights the wrong part of a statement or truncates source 
lines in the assembly view. It's better to have no column information at all.

So by default, we'll omit the column information for CodeView targeting Windows.

Since the column info is still useful for sanitizers, I've promoted 
-gcolumn-info (and -gno-column-info) to a CoreOption and added a couple tests 
to make sure that works for clang-cl.

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

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=279765&r1=279764&r2=279765&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
@@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
   Group;
 def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
 def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group;
-def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
-def gno_column_info : Flag<["-"], "gno-column-info">, Group;
+def gcolumn_info : Flag<["-"], "gcolumn-info">, Group, 
Flags<[CoreOption]>;
+def gno_column_info : Flag<["-"], "gno-column-info">, Group, 
Flags<[CoreOption]>;
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279765&r1=279764&r2=279765&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
@@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
   case llvm::Triple::wasm32:
   case llvm::Triple::wasm64:
 getWebAssemblyTargetFeatures(Args, Features);
-break; 
+break;
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel:
   case llvm::Triple::sparcv9:
@@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation &C,
   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
   Args.ClaimAllArgs(options::OPT_g_flags_Group);
 
-  // PS4 defaults to no column info
+  // Column info is included by default for everything except PS4 and CodeView.
+  // Clang doesn't track end columns, just starting columns, which, in theory,
+  // is fine for CodeView (and PDB).  In practice, however, the Microsoft
+  // debuggers don't handle missing end columns well, so it's better not to
+  // include any column info.
   if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
-   /*Default=*/ !IsPS4CPU))
+   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC && EmitCodeView)))
 CmdArgs.push_back("-dwarf-column-info");
 
   // FIXME: Move backend command line options to the module.
@@ -6712,7 +6716,7 @@ void ClangAs::ConstructJob(Compilation &
   case llvm::Triple::mips64el:
 AddMIPSTargetArgs(Args, CmdArgs);
 break;
-
+
   case llvm::Triple::x86:
   case llvm::Triple::x86_64:
 AddX86TargetArgs(Args, CmdArgs);

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279765&r1=279764&r2=279765&view=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Thu Aug 25 13:24:35 2016
@@ -50,6 +50,15 @@
 // fpstrict-NOT: -menable-unsafe-fp-math
 // fpstrict-NOT: -ffast-math
 
+// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck 
-check-prefix=gcolumn %s
+// gcolumn: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck 
-check-prefix=gnocolumn %s
+// gnocolumn-NOT: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
+// gdefcolumn-NOT: -dwarf-column-info
+
 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
 // GA: -ftls-model=local-exec
 


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


Re: [PATCH] D23720: Omit column info for CodeView by default

2016-08-25 Thread Adrian McCarthy via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279765: Omit column info for CodeView by default (authored 
by amccarth).

Changed prior to commit:
  https://reviews.llvm.org/D23720?vs=68713&id=69274#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23720

Files:
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/cl-options.c

Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1305,8 +1305,8 @@
   Group;
 def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
 def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group;
-def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
-def gno_column_info : Flag<["-"], "gno-column-info">, Group;
+def gcolumn_info : Flag<["-"], "gcolumn-info">, Group, 
Flags<[CoreOption]>;
+def gno_column_info : Flag<["-"], "gno-column-info">, Group, 
Flags<[CoreOption]>;
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
Index: cfe/trunk/test/Driver/cl-options.c
===
--- cfe/trunk/test/Driver/cl-options.c
+++ cfe/trunk/test/Driver/cl-options.c
@@ -50,6 +50,15 @@
 // fpstrict-NOT: -menable-unsafe-fp-math
 // fpstrict-NOT: -ffast-math
 
+// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck 
-check-prefix=gcolumn %s
+// gcolumn: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck 
-check-prefix=gnocolumn %s
+// gnocolumn-NOT: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
+// gdefcolumn-NOT: -dwarf-column-info
+
 // RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
 // GA: -ftls-model=local-exec
 
Index: cfe/trunk/lib/Driver/Tools.cpp
===
--- cfe/trunk/lib/Driver/Tools.cpp
+++ cfe/trunk/lib/Driver/Tools.cpp
@@ -2574,7 +2574,7 @@
   case llvm::Triple::wasm32:
   case llvm::Triple::wasm64:
 getWebAssemblyTargetFeatures(Args, Features);
-break; 
+break;
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel:
   case llvm::Triple::sparcv9:
@@ -4656,9 +4656,13 @@
   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
   Args.ClaimAllArgs(options::OPT_g_flags_Group);
 
-  // PS4 defaults to no column info
+  // Column info is included by default for everything except PS4 and CodeView.
+  // Clang doesn't track end columns, just starting columns, which, in theory,
+  // is fine for CodeView (and PDB).  In practice, however, the Microsoft
+  // debuggers don't handle missing end columns well, so it's better not to
+  // include any column info.
   if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
-   /*Default=*/ !IsPS4CPU))
+   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC && EmitCodeView)))
 CmdArgs.push_back("-dwarf-column-info");
 
   // FIXME: Move backend command line options to the module.
@@ -6712,7 +6716,7 @@
   case llvm::Triple::mips64el:
 AddMIPSTargetArgs(Args, CmdArgs);
 break;
-
+
   case llvm::Triple::x86:
   case llvm::Triple::x86_64:
 AddX86TargetArgs(Args, CmdArgs);


Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -1305,8 +1305,8 @@
   Group;
 def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
 def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group;
-def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
-def gno_column_info : Flag<["-"], "gno-column-info">, Group;
+def gcolumn_info : Flag<["-"], "gcolumn-info">, Group, Flags<[CoreOption]>;
+def gno_column_info : Flag<["-"], "gno-column-info">, Group, Flags<[CoreOption]>;
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
Index: cfe/trunk/test/Driver/cl-options.c
===
--- cfe/trunk/test/Driver/cl-options.c
+++ cfe/trunk/test/Driver/cl-options.c
@@ -50,6 +50,15 @@
 // fpstrict-NOT: -menable-unsafe-fp-math
 // fpstrict-NOT: -ffast-math
 
+// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s
+// gcolumn: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s
+// gnocolumn-NOT: -dwarf-column-info
+
+// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
+// gdefcolumn-NOT: -dwarf-column-info
+
 // RUN: %clang_cl /GA -### -- %s 2>&

Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-25 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: clang-tidy-vs/ClangTidy/CheckTree.cs:68
@@ +67,3 @@
+return Name_;
+return ParentPath + "-" + Name_;
+}

OK, cool.  I assumed that the root had a name.  Thus a node with no parent (a 
root) could return its name and the rest of the children would each append '-' 
+ Name_.  But if roots are nameless, then your solution is fine.


https://reviews.llvm.org/D23848



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


Re: r279765 - Omit column info for CodeView by default

2016-08-29 Thread Adrian McCarthy via cfe-commits
Thanks.  I was trying to be consistent with how the prefixes were used in
this particular file, where the prefix was modeled after the case-sensitive
flags being tested.

On Mon, Aug 29, 2016 at 8:49 AM, David Blaikie  wrote:

>
>
> On Thu, Aug 25, 2016 at 11:32 AM Adrian McCarthy via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: amccarth
>> Date: Thu Aug 25 13:24:35 2016
>> New Revision: 279765
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=279765&view=rev
>> Log:
>> Omit column info for CodeView by default
>>
>> Clang tracks only start columns, not start-end ranges. CodeView allows
>> for that, but the VS debugger doesn't handle anything less than a complete
>> range well--it either highlights the wrong part of a statement or truncates
>> source lines in the assembly view. It's better to have no column
>> information at all.
>>
>> So by default, we'll omit the column information for CodeView targeting
>> Windows.
>>
>> Since the column info is still useful for sanitizers, I've promoted
>> -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple
>> tests to make sure that works for clang-cl.
>>
>> Differential Revision: https://reviews.llvm.org/D23720
>>
>> Modified:
>> cfe/trunk/include/clang/Driver/Options.td
>> cfe/trunk/lib/Driver/Tools.cpp
>> cfe/trunk/test/Driver/cl-options.c
>>
>> Modified: cfe/trunk/include/clang/Driver/Options.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
>> clang/Driver/Options.td?rev=279765&r1=279764&r2=279765&view=diff
>> 
>> ==
>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>> +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
>> @@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
>>Group;
>>  def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
>>  def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">,
>> Group;
>> -def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
>> -def gno_column_info : Flag<["-"], "gno-column-info">,
>> Group;
>> +def gcolumn_info : Flag<["-"], "gcolumn-info">, Group,
>> Flags<[CoreOption]>;
>> +def gno_column_info : Flag<["-"], "gno-column-info">,
>> Group, Flags<[CoreOption]>;
>>  def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
>>  def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
>>  def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
>> Tools.cpp?rev=279765&r1=279764&r2=279765&view=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
>> @@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
>>case llvm::Triple::wasm32:
>>case llvm::Triple::wasm64:
>>  getWebAssemblyTargetFeatures(Args, Features);
>> -break;
>> +break;
>>case llvm::Triple::sparc:
>>case llvm::Triple::sparcel:
>>case llvm::Triple::sparcv9:
>> @@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation &C,
>>// We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>>Args.ClaimAllArgs(options::OPT_g_flags_Group);
>>
>> -  // PS4 defaults to no column info
>> +  // Column info is included by default for everything except PS4 and
>> CodeView.
>> +  // Clang doesn't track end columns, just starting columns, which, in
>> theory,
>> +  // is fine for CodeView (and PDB).  In practice, however, the Microsoft
>> +  // debuggers don't handle missing end columns well, so it's better not
>> to
>> +  // include any column info.
>>if (Args.hasFlag(options::OPT_gcolumn_info,
>> options::OPT_gno_column_info,
>> -   /*Default=*/ !IsPS4CPU))
>> +   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC &&
>> EmitCodeView)))
>>  CmdArgs.push_back("-dwarf-column-info");
>>
>>// FIXME: Move backend command line options to the module.
>> @@ -6712,7 +

Re: r279765 - Omit column info for CodeView by default

2016-08-29 Thread Adrian McCarthy via cfe-commits
Sorry, no, I don't have plans to implement column ranges at this time.

On Mon, Aug 29, 2016 at 2:10 PM, Adrian Prantl  wrote:

>
> > On Aug 25, 2016, at 11:24 AM, Adrian McCarthy via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >
> > Author: amccarth
> > Date: Thu Aug 25 13:24:35 2016
> > New Revision: 279765
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=279765&view=rev
> > Log:
> > Omit column info for CodeView by default
> >
> > Clang tracks only start columns, not start-end ranges. CodeView allows
> for that, but the VS debugger doesn't handle anything less than a complete
> range well--it either highlights the wrong part of a statement or truncates
> source lines in the assembly view. It's better to have no column
> information at all.
>
> Do you have any plans on implementing this? I'd be very interested in
> having full start-end ranges (perhaps encoded as start line/column+length)
> available in DWARF, too.
>
> -- adrian
>
> >
> > So by default, we'll omit the column information for CodeView targeting
> Windows.
> >
> > Since the column info is still useful for sanitizers, I've promoted
> -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple
> tests to make sure that works for clang-cl.
> >
> > Differential Revision: https://reviews.llvm.org/D23720
> >
> > Modified:
> >cfe/trunk/include/clang/Driver/Options.td
> >cfe/trunk/lib/Driver/Tools.cpp
> >cfe/trunk/test/Driver/cl-options.c
> >
> > Modified: cfe/trunk/include/clang/Driver/Options.td
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Driver/Options.td?rev=279765&r1=279764&r2=279765&view=diff
> > 
> ==
> > --- cfe/trunk/include/clang/Driver/Options.td (original)
> > +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
> > @@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
> >   Group;
> > def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
> > def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">,
> Group;
> > -def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
> > -def gno_column_info : Flag<["-"], "gno-column-info">,
> Group;
> > +def gcolumn_info : Flag<["-"], "gcolumn-info">, Group,
> Flags<[CoreOption]>;
> > +def gno_column_info : Flag<["-"], "gno-column-info">,
> Group, Flags<[CoreOption]>;
> > def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
> > def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
> > def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> Tools.cpp?rev=279765&r1=279764&r2=279765&view=diff
> > 
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
> > @@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
> >   case llvm::Triple::wasm32:
> >   case llvm::Triple::wasm64:
> > getWebAssemblyTargetFeatures(Args, Features);
> > -break;
> > +break;
> >   case llvm::Triple::sparc:
> >   case llvm::Triple::sparcel:
> >   case llvm::Triple::sparcv9:
> > @@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation &C,
> >   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
> >   Args.ClaimAllArgs(options::OPT_g_flags_Group);
> >
> > -  // PS4 defaults to no column info
> > +  // Column info is included by default for everything except PS4 and
> CodeView.
> > +  // Clang doesn't track end columns, just starting columns, which, in
> theory,
> > +  // is fine for CodeView (and PDB).  In practice, however, the
> Microsoft
> > +  // debuggers don't handle missing end columns well, so it's better
> not to
> > +  // include any column info.
> >   if (Args.hasFlag(options::OPT_gcolumn_info,
> options::OPT_gno_column_info,
> > -   /*Default=*/ !IsPS4CPU))
> > +   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC &&
> EmitCodeView)))
> > CmdArgs.push_back("-dwarf-column-info&qu

[PATCH] D22577: Include unreferenced nested types in member list only for CodeView

2016-07-20 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added reviewers: rnk, dblaikie.
amccarth added a subscriber: cfe-commits.

Unreferenced nested structs and classes were omitted from the debug info.  In 
DWARF, this was intentional, to avoid bloat.  But, for CodeView, we want this 
information to be consistent with what Microsoft tools would produce and expect.

This is essentially my earlier patch with a switch to apply it only when 
generating CodeView.

https://reviews.llvm.org/D22577

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
  test/CodeGenCXX/debug-info-ms-abi.cpp
  test/Modules/ModuleDebugInfo.cpp

Index: test/Modules/ModuleDebugInfo.cpp
===
--- test/Modules/ModuleDebugInfo.cpp
+++ test/Modules/ModuleDebugInfo.cpp
@@ -121,15 +121,19 @@
 // CHECK-SAME: flags: DIFlagFwdDecl,
 // CHECK-SAME: identifier: "_ZTS9Template1IPvE")
 
-// Explicit instatiation.
+// Explicit instantiation.
 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Template1",
 // CHECK-SAME: templateParams:
 // CHECK-SAME: identifier: "_ZTS9Template1IiE")
 
 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdDeclTemplate",
 // CHECK-SAME: flags: DIFlagFwdDecl
 // CHECK-SAME: identifier: "_ZTS15FwdDeclTemplateIiE")
 
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Member",
+// CHECK-SAME: flags: DIFlagFwdDecl
+// CHECK-SAME: identifier: "_ZTSN11SpecializedIiE6MemberE")
+
 // Forward-declared member of a template.
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Member",
 // CHECK-SAME: flags: DIFlagFwdDecl
Index: test/CodeGenCXX/debug-info-ms-abi.cpp
===
--- test/CodeGenCXX/debug-info-ms-abi.cpp
+++ test/CodeGenCXX/debug-info-ms-abi.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s
 
 // Tests that certain miscellaneous features work in the MS ABI.
 
@@ -14,6 +14,9 @@
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
 // CHECK-SAME: identifier: ".?AUFoo@@"
 
+// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
+// CHECK-SAME: identifier: ".?AUNested@Foo@@"
+
 // CHECK: !DISubprogram(name: "f",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
@@ -25,6 +28,3 @@
 // CHECK: !DISubprogram(name: "h",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
-
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
-// CHECK-SAME: identifier: ".?AUNested@Foo@@"
Index: test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
===
--- test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
+++ test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
@@ -19,6 +19,6 @@
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -254,6 +254,8 @@
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1090,6 +1090,13 @@
   elements.push_back(FieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1101,6 +1108,10 @@
   else {
 const ASTRecordLayout &layout = CGM.getContext().getA

Re: [PATCH] D22577: Include unreferenced nested types in member list only for CodeView

2016-07-20 Thread Adrian McCarthy via cfe-commits
amccarth updated this revision to Diff 64761.
amccarth added a comment.

Addressed feedback.


https://reviews.llvm.org/D22577

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
  test/CodeGenCXX/debug-info-ms-abi.cpp
  test/Modules/ModuleDebugInfo.cpp

Index: test/Modules/ModuleDebugInfo.cpp
===
--- test/Modules/ModuleDebugInfo.cpp
+++ test/Modules/ModuleDebugInfo.cpp
@@ -121,15 +121,19 @@
 // CHECK-SAME: flags: DIFlagFwdDecl,
 // CHECK-SAME: identifier: "_ZTS9Template1IPvE")
 
-// Explicit instatiation.
+// Explicit instantiation.
 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Template1",
 // CHECK-SAME: templateParams:
 // CHECK-SAME: identifier: "_ZTS9Template1IiE")
 
 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdDeclTemplate",
 // CHECK-SAME: flags: DIFlagFwdDecl
 // CHECK-SAME: identifier: "_ZTS15FwdDeclTemplateIiE")
 
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Member",
+// CHECK-SAME: flags: DIFlagFwdDecl
+// CHECK-SAME: identifier: "_ZTSN11SpecializedIiE6MemberE")
+
 // Forward-declared member of a template.
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Member",
 // CHECK-SAME: flags: DIFlagFwdDecl
Index: test/CodeGenCXX/debug-info-ms-abi.cpp
===
--- test/CodeGenCXX/debug-info-ms-abi.cpp
+++ test/CodeGenCXX/debug-info-ms-abi.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s
 
 // Tests that certain miscellaneous features work in the MS ABI.
 
@@ -12,19 +12,22 @@
 Foo::Nested n;
 
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
+// CHECK-SAME: elements: ![[elements:[0-9]+]]
 // CHECK-SAME: identifier: ".?AUFoo@@"
 
-// CHECK: !DISubprogram(name: "f",
+// CHECK: ![[elements]] = !{![[vptr:[0-9]+]], ![[Nested:[0-9]+]], ![[f:[0-9]+]], ![[g:[0-9]+]], ![[h:[0-9]+]]}
+
+// CHECK: ![[Nested]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
+// CHECK-SAME: identifier: ".?AUNested@Foo@@"
+
+// CHECK: ![[f]] = !DISubprogram(name: "f",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
 
-// CHECK: !DISubprogram(name: "g",
+// CHECK: ![[g]] = !DISubprogram(name: "g",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 1,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
 
-// CHECK: !DISubprogram(name: "h",
+// CHECK: ![[h]] = !DISubprogram(name: "h",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
-
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
-// CHECK-SAME: identifier: ".?AUNested@Foo@@"
Index: test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
===
--- test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
+++ test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
@@ -19,6 +19,6 @@
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -254,6 +254,8 @@
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1090,6 +1090,14 @@
   elements.push_back(FieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  SourceLocation Loc = RD->getLocation();
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo

Re: [PATCH] D22577: Include unreferenced nested types in member list only for CodeView

2016-07-20 Thread Adrian McCarthy via cfe-commits
amccarth marked 2 inline comments as done.
amccarth added a comment.

https://reviews.llvm.org/D22577



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


r276271 - Include unreferenced nested types in member list only for CodeView

2016-07-21 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Thu Jul 21 08:16:14 2016
New Revision: 276271

URL: http://llvm.org/viewvc/llvm-project?rev=276271&view=rev
Log:
Include unreferenced nested types in member list only for CodeView

Unreferenced nested structs and classes were omitted from the debug info.  In 
DWARF, this was intentional, to avoid bloat.  But for CodeView, we want this 
information to be consistent with what Microsoft tools would produce and expect.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
cfe/trunk/test/Modules/ModuleDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=276271&r1=276270&r2=276271&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jul 21 08:16:14 2016
@@ -1090,6 +1090,14 @@ void CGDebugInfo::CollectRecordNormalFie
   elements.push_back(FieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  SourceLocation Loc = RD->getLocation();
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1101,6 +1109,10 @@ void CGDebugInfo::CollectRecordFields(
   else {
 const ASTRecordLayout &layout = 
CGM.getContext().getASTRecordLayout(record);
 
+// Debug info for nested records is included in the member list only for
+// CodeView.
+bool IncludeNestedRecords = CGM.getCodeGenOpts().EmitCodeView;
+
 // Field number for non-static fields.
 unsigned fieldNo = 0;
 
@@ -1126,7 +1138,10 @@ void CGDebugInfo::CollectRecordFields(
 
 // Bump field number for next field.
 ++fieldNo;
-  }
+  } else if (const auto *nestedRec = dyn_cast(I))
+if (IncludeNestedRecords && !nestedRec->isImplicit() &&
+nestedRec->getDeclContext() == record)
+  CollectRecordNestedRecord(nestedRec, elements);
   }
 }
 
@@ -3620,8 +3635,8 @@ void CGDebugInfo::EmitUsingDirective(con
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() || 
-  CGM.getCodeGenOpts().DebugExplicitImport) { 
+  if (!NSDecl->isAnonymousNamespace() ||
+  CGM.getCodeGenOpts().DebugExplicitImport) {
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=276271&r1=276270&r2=276271&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Jul 21 08:16:14 2016
@@ -254,6 +254,8 @@ class CGDebugInfo {
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=276271&r1=276270&r2=276271&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Thu Jul 21 08:16:14 
2016
@@ -19,6 +19,6 @@ protected:
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"

Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=276271&r1=276270&r2=276271&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp Thu Jul 21 08:16:14 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-

r276279 - Revert "Include unreferenced nested types in member list only for CodeView"

2016-07-21 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Thu Jul 21 08:41:25 2016
New Revision: 276279

URL: http://llvm.org/viewvc/llvm-project?rev=276279&view=rev
Log:
Revert "Include unreferenced nested types in member list only for CodeView"

Patch broke ModuleDebugInfo test on the build bots (but not locally).  Again.

svn revision:  r276271

This reverts commit 9da8a1b05362bc96f2855fb32b5588b89407685d.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
cfe/trunk/test/Modules/ModuleDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=276279&r1=276278&r2=276279&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jul 21 08:41:25 2016
@@ -1090,14 +1090,6 @@ void CGDebugInfo::CollectRecordNormalFie
   elements.push_back(FieldType);
 }
 
-void CGDebugInfo::CollectRecordNestedRecord(
-const RecordDecl *RD, SmallVectorImpl &elements) {
-  QualType Ty = CGM.getContext().getTypeDeclType(RD);
-  SourceLocation Loc = RD->getLocation();
-  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));
-  elements.push_back(nestedType);
-}
-
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1109,10 +1101,6 @@ void CGDebugInfo::CollectRecordFields(
   else {
 const ASTRecordLayout &layout = 
CGM.getContext().getASTRecordLayout(record);
 
-// Debug info for nested records is included in the member list only for
-// CodeView.
-bool IncludeNestedRecords = CGM.getCodeGenOpts().EmitCodeView;
-
 // Field number for non-static fields.
 unsigned fieldNo = 0;
 
@@ -1138,10 +1126,7 @@ void CGDebugInfo::CollectRecordFields(
 
 // Bump field number for next field.
 ++fieldNo;
-  } else if (const auto *nestedRec = dyn_cast(I))
-if (IncludeNestedRecords && !nestedRec->isImplicit() &&
-nestedRec->getDeclContext() == record)
-  CollectRecordNestedRecord(nestedRec, elements);
+  }
   }
 }
 
@@ -3635,8 +3620,8 @@ void CGDebugInfo::EmitUsingDirective(con
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() ||
-  CGM.getCodeGenOpts().DebugExplicitImport) {
+  if (!NSDecl->isAnonymousNamespace() || 
+  CGM.getCodeGenOpts().DebugExplicitImport) { 
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=276279&r1=276278&r2=276279&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Jul 21 08:41:25 2016
@@ -254,8 +254,6 @@ class CGDebugInfo {
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
-  void CollectRecordNestedRecord(const RecordDecl *RD,
- SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=276279&r1=276278&r2=276279&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Thu Jul 21 08:41:25 
2016
@@ -19,6 +19,6 @@ protected:
 
 Test t;
 
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
 // CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"

Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=276279&r1=276278&r2=276279&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp Thu Jul 21 08:41:25 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited 
-gcodeview -emit-llvm -o - 

r276317 - Reroll "Include unreferenced nested types in member list only for CodeView"

2016-07-21 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Thu Jul 21 13:43:20 2016
New Revision: 276317

URL: http://llvm.org/viewvc/llvm-project?rev=276317&view=rev
Log:
Reroll "Include unreferenced nested types in member list only for CodeView"

Another attempt at r276271, hopefully without breaking ModuleDebugInfo test.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
cfe/trunk/test/Modules/ModuleDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=276317&r1=276316&r2=276317&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jul 21 13:43:20 2016
@@ -1090,6 +1090,14 @@ void CGDebugInfo::CollectRecordNormalFie
   elements.push_back(FieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  SourceLocation Loc = RD->getLocation();
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1101,6 +1109,10 @@ void CGDebugInfo::CollectRecordFields(
   else {
 const ASTRecordLayout &layout = 
CGM.getContext().getASTRecordLayout(record);
 
+// Debug info for nested records is included in the member list only for
+// CodeView.
+bool IncludeNestedRecords = CGM.getCodeGenOpts().EmitCodeView;
+
 // Field number for non-static fields.
 unsigned fieldNo = 0;
 
@@ -1126,7 +1138,10 @@ void CGDebugInfo::CollectRecordFields(
 
 // Bump field number for next field.
 ++fieldNo;
-  }
+  } else if (const auto *nestedRec = dyn_cast(I))
+if (IncludeNestedRecords && !nestedRec->isImplicit() &&
+nestedRec->getDeclContext() == record)
+  CollectRecordNestedRecord(nestedRec, elements);
   }
 }
 
@@ -3620,8 +3635,8 @@ void CGDebugInfo::EmitUsingDirective(con
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() || 
-  CGM.getCodeGenOpts().DebugExplicitImport) { 
+  if (!NSDecl->isAnonymousNamespace() ||
+  CGM.getCodeGenOpts().DebugExplicitImport) {
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=276317&r1=276316&r2=276317&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Jul 21 13:43:20 2016
@@ -254,6 +254,8 @@ class CGDebugInfo {
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=276317&r1=276316&r2=276317&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Thu Jul 21 13:43:20 
2016
@@ -19,6 +19,6 @@ protected:
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"

Modified: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp?rev=276317&r1=276316&r2=276317&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp Thu Jul 21 13:43:20 2016
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited 
-emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=i686-pc-windows-msvc -debug-info-kind=limited 
-gcodeview -emit-llvm -o

[PATCH] D23462: Emit debug info for abstract classes if they are imported from a DLL

2016-08-12 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth added a subscriber: cfe-commits.

With -debug-info-kind=limited, we omit debug info for abstract classes that 
live in other TUs.  This reduces duplicate type information.  When statically 
linked, the type information comes together.  But if your binary has a class 
derived from a base in a DLL, the base class info is not available to the 
debugger.

The decision is made in shouldOmitDefinition (CGDebugInfo.cpp).  Per a 
suggestion from rnk, I've tweaked the decision so that we do include 
definitions for classes marked as DLL imports.  This should be a relatively 
small number of classes, so we don't pay a large price for duplication of the 
type info, yet it should cover most cases on Windows.

Tested manually on Windows.  I'm working on a lit test, and I'll update this 
patch with it when it's finished.

https://reviews.llvm.org/D23462

Files:
  lib/CodeGen/CGDebugInfo.cpp

Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1685,7 +1685,8 @@
   if (!CXXDecl)
 return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;


Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1685,7 +1685,8 @@
   if (!CXXDecl)
 return false;
 
-  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())
+  if (CXXDecl->hasDefinition() && CXXDecl->isDynamicClass() &&
+  !CXXDecl->hasAttr())
 return true;
 
   TemplateSpecializationKind Spec = TSK_Undeclared;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-10 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth added a subscriber: cfe-commits.

`-fms-compatibility-version` was defaulting to 18 (VS 2013), which is a pain if 
your environment is pointing to version 19 (VS 2015) libraries.

If cl.exe can be found, this patch uses its version number as the default 
instead.  It re-uses the existing code to find the Visual Studio binaries 
folder and WinAPI methods to check its version.  You can still explicitly 
specify a compatibility version on the command line.  If you don't have cl.exe, 
this should be a no-op and you'll get the old default of 18.

This affected the tests, which assumed that if you didn't specific a version, 
that it would default to 18, but this won't be true for all machines.  So a 
couple test cases had to be eliminated and a couple others had to be tweaked to 
allow for various outputs.

Addresses:  https://llvm.org/bugs/show_bug.cgi?id=27215

http://reviews.llvm.org/D20136

Files:
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/cl-options.c
  test/Driver/msc-version.c
  test/Driver/msvc-triple.c
  test/Misc/diag-format.c
  tools/driver/driver.cpp

Index: tools/driver/driver.cpp
===
--- tools/driver/driver.cpp
+++ tools/driver/driver.cpp
@@ -501,7 +501,7 @@
 
 #ifdef LLVM_ON_WIN32
   // Exit status should not be negative on Win32, unless abnormal termination.
-  // Once abnormal termiation was caught, negative status should not be
+  // Once abnormal termination was caught, negative status should not be
   // propagated.
   if (Res < 0)
 Res = 1;
Index: test/Misc/diag-format.c
===
--- test/Misc/diag-format.c
+++ test/Misc/diag-format.c
@@ -37,7 +37,7 @@
 // DEFAULT: {{.*}}:36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2010: {{.*}}(36,7) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2013: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
-// MSVC: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
+// MSVC: {{.*}}(36,8){{ ?}}: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015: {{.*}}(36,8): warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // VI: {{.*}} +36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015_ORIG: {{.*}}(36): warning: extra tokens at end of #endif directive [-Wextra-tokens]
Index: test/Driver/msvc-triple.c
===
--- test/Driver/msvc-triple.c
+++ test/Driver/msvc-triple.c
@@ -1,9 +1,7 @@
-// RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
 // RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19
 // RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19
 // RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT
 
-// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0"
 // TARGET-19:   target triple = "i686-pc-windows-msvc19.0.0"
 // OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0"
-// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf"
+// ELF-DEFAULT: target triple = "i686-pc-windows-msvc{{.*}}-elf"
Index: test/Driver/msc-version.c
===
--- test/Driver/msc-version.c
+++ test/Driver/msc-version.c
@@ -1,15 +1,4 @@
 //
-// Verify defaults
-//
-
-// RUN: %clang -target i686-windows -fms-compatibility -dM -E - &1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // NoThreadSafeStatics: "-fno-threadsafe-statics"
 
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -682,7 +682,8 @@
 
 /// Visual studio tools.
 namespace visualstudio {
-VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple &Triple,
+VersionTuple getMSVCVersion(const Driver *D, const ToolChain &TC,
+const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args, bool IsWindowsMSVC);
 
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3291,7 +3291,7 @@
   Result.append(UID.begin(), UID.end());
 }
 
-VersionTuple visualstudio::getM

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-10 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:477
@@ +476,3 @@
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoA(ClExe.c_str(), 0, VersionSize,
+ VersionBlock.data())) {

thakis wrote:
> We already stat a bunch of directories to find the sdk include path. Can we 
> use the result of that instead of looking at cl.exe? Then we wouldn't have to 
> do additional stats.
I'm just a simple CPM/VMS/Windows developer.  Your Linux terms (stat) frighten 
and confuse me.

Seriously, though, this API isn't a file system check.  It's digging out the 
version record from the file's resources.

We _could_ guess at the version from the names of the directories in the path, 
but that would require mapping names to versions, and if it's installed in a 
non-standard place it wouldn't help at all.

Also, `-fms-compatibility-version` is really about the version of the compiler 
(cl.exe), not that of the standard library nor of the SDK, so trying to check 
something else as a proxy for the version seems prone to obscure failures.

I share your concern about speed, especially since getting the version happens 
twice (once for the triple and once for the compatibility version), but 
invoking clang and having it choose the wrong default costs a lot of time, too.

The bug report correctly says we shouldn't spin up a process to run `cl 
/version`--that would be far more expensive.  And if you put 
`-fms-compatibility-version` on the command line, then this function won't be 
called as it won't need to figure out the default.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-10 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:472
@@ +471,3 @@
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeA(ClExe.c_str(), nullptr);
+  if (VersionSize == 0) {

majnemer wrote:
> Why not use the `GetFileVersionInfoSizeW` variant?
I started down that road, but it seemed overkill to convert the path to a wide 
string.  I'm happy to do it if you think it worthwhile.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-10 Thread Adrian McCarthy via cfe-commits
amccarth updated this revision to Diff 56833.
amccarth marked an inline comment as done.
amccarth added a comment.

Addressed most comments: now using wide-chars for WinAPI calls, made 
getMSVCVersionFromExe a virtual method, removed extraneous typo-correction.


http://reviews.llvm.org/D20136

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/cl-options.c
  test/Driver/msc-version.c
  test/Driver/msvc-triple.c
  test/Misc/diag-format.c

Index: test/Misc/diag-format.c
===
--- test/Misc/diag-format.c
+++ test/Misc/diag-format.c
@@ -37,7 +37,7 @@
 // DEFAULT: {{.*}}:36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2010: {{.*}}(36,7) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2013: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
-// MSVC: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
+// MSVC: {{.*}}(36,8){{ ?}}: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015: {{.*}}(36,8): warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // VI: {{.*}} +36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015_ORIG: {{.*}}(36): warning: extra tokens at end of #endif directive [-Wextra-tokens]
Index: test/Driver/msvc-triple.c
===
--- test/Driver/msvc-triple.c
+++ test/Driver/msvc-triple.c
@@ -1,9 +1,7 @@
-// RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
 // RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19
 // RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19
 // RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT
 
-// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0"
 // TARGET-19:   target triple = "i686-pc-windows-msvc19.0.0"
 // OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0"
-// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf"
+// ELF-DEFAULT: target triple = "i686-pc-windows-msvc{{.*}}-elf"
Index: test/Driver/msc-version.c
===
--- test/Driver/msc-version.c
+++ test/Driver/msc-version.c
@@ -1,15 +1,4 @@
 //
-// Verify defaults
-//
-
-// RUN: %clang -target i686-windows -fms-compatibility -dM -E - &1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // NoThreadSafeStatics: "-fno-threadsafe-statics"
 
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -682,7 +682,8 @@
 
 /// Visual studio tools.
 namespace visualstudio {
-VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple &Triple,
+VersionTuple getMSVCVersion(const Driver *D, const ToolChain &TC,
+const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args, bool IsWindowsMSVC);
 
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3291,7 +3291,7 @@
   Result.append(UID.begin(), UID.end());
 }
 
-VersionTuple visualstudio::getMSVCVersion(const Driver *D,
+VersionTuple visualstudio::getMSVCVersion(const Driver *D, const ToolChain &TC,
   const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args,
   bool IsWindowsMSVC) {
@@ -,8 +,14 @@
 if (Major || Minor || Micro)
   return VersionTuple(Major, Minor, Micro);
 
-// FIXME: Consider bumping this to 19 (MSVC2015) soon.
-return VersionTuple(18);
+if (IsWindowsMSVC) {
+  VersionTuple MSVT = TC.getMSVCVersionFromExe();
+  if (!MSVT.empty())
+return MSVT;
+
+  // FIXME: Consider bumping this to 19 (MSVC2015) soon.
+  return VersionTuple(18);
+}
   }
   return VersionTuple();
 }
@@ -5224,7 +5230,7 @@
 
   // -fms-compatibility-version=18.00 is default.
   VersionTuple MSVT = visualstudio::getMSVCVersion(
-  &D, getToolChain().getTriple(), Args, IsWindowsMSVC);
+  &D, getToolChain(), getToolChain().getTriple(), Args, IsWindowsMSVC);
   if (!MSVT.empty())
 CmdArgs.push_back(
 Args.MakeArgString("-fms-compatibility-

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-10 Thread Adrian McCarthy via cfe-commits
amccarth marked 4 inline comments as done.


Comment at: lib/Driver/MSVCToolChain.cpp:478
@@ +477,3 @@
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeW(ClExeWide.c_str(),
+  nullptr);

Yes, it looks in the executable (which I tried to emphasize with the method 
name).

I don't think this is very expensive given that Explorer often makes zillions 
of such calls, but I'm open to other suggestions.

I know that you can't use a library that's newer than the compiler (because it 
may use new language features), but I don't know if that applies in the other 
direction or how we would safely and reliably map directory names to library 
versions and therefore to compiler versions.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-11 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:478
@@ +477,3 @@
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeW(ClExeWide.c_str(),
+  nullptr);

thakis wrote:
> amccarth wrote:
> > Yes, it looks in the executable (which I tried to emphasize with the method 
> > name).
> > 
> > I don't think this is very expensive given that Explorer often makes 
> > zillions of such calls, but I'm open to other suggestions.
> > 
> > I know that you can't use a library that's newer than the compiler (because 
> > it may use new language features), but I don't know if that applies in the 
> > other direction or how we would safely and reliably map directory names to 
> > library versions and therefore to compiler versions.
> I agree that figuring out the right value for fmsc-version automatically 
> somehow is definitely something we should do.
> 
> I forgot that `getVisualStudioBinariesFolder` already works by looking for 
> cl.exe in PATH, so cl.exe's metadata is already warmed up in the disk cache. 
> However, GetFileVersionInfoW() probably opens cl.exe itself and does some PE 
> parsing to get at the version, and that probably is in cold cache territory. 
> (https://msdn.microsoft.com/en-us/library/windows/desktop/ms647003(v=vs.85).aspx
>  suggests that this function might open several files).
> 
> `getVisualStudioBinariesFolder` checks:
> 
> 1. getenv("VCINSTALLDIR")
> 2. cl.exe in getenv("PATH")
> 3. registry (via getVisualStudioInstallDir)
> 
> The common cases are 1 and 3. For 1, for default installs, the version number 
> is part of the directory name (for default installs, what most people have). 
> For 3, the version number is in the registry key we query. So in most cases 
> we shouldn't have to look at cl.exe itself. And for the cases where we would 
> have to look, maybe it's ok to require an explicit fmsc-version flag.
The version number in the directory name and the registry is the version number 
of Visual Studio not of the compiler.  Yes, we could do a mapping (VS 14 comes 
bundled with CL 19), assuming Microsoft continues to keep VS releases and 
compiler releases in sync, and it means this code will forever need updates to 
the mapping data.

The mapping would give just the major version number, which might be all that 
matters now, but if there's ever a CL 19.1 that has different compatibility 
requirements (and is maybe released out-of-band with Visual Studio), we'd be 
stuck.

Getting the actual version from the compiler seems the most accurate and 
future-proof way to check.  If that's too expensive, then maybe we should 
abandon the idea of detecting the default for compatibility.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-11 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:478
@@ +477,3 @@
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeW(ClExeWide.c_str(),
+  nullptr);

amccarth wrote:
> thakis wrote:
> > amccarth wrote:
> > > Yes, it looks in the executable (which I tried to emphasize with the 
> > > method name).
> > > 
> > > I don't think this is very expensive given that Explorer often makes 
> > > zillions of such calls, but I'm open to other suggestions.
> > > 
> > > I know that you can't use a library that's newer than the compiler 
> > > (because it may use new language features), but I don't know if that 
> > > applies in the other direction or how we would safely and reliably map 
> > > directory names to library versions and therefore to compiler versions.
> > I agree that figuring out the right value for fmsc-version automatically 
> > somehow is definitely something we should do.
> > 
> > I forgot that `getVisualStudioBinariesFolder` already works by looking for 
> > cl.exe in PATH, so cl.exe's metadata is already warmed up in the disk 
> > cache. However, GetFileVersionInfoW() probably opens cl.exe itself and does 
> > some PE parsing to get at the version, and that probably is in cold cache 
> > territory. 
> > (https://msdn.microsoft.com/en-us/library/windows/desktop/ms647003(v=vs.85).aspx
> >  suggests that this function might open several files).
> > 
> > `getVisualStudioBinariesFolder` checks:
> > 
> > 1. getenv("VCINSTALLDIR")
> > 2. cl.exe in getenv("PATH")
> > 3. registry (via getVisualStudioInstallDir)
> > 
> > The common cases are 1 and 3. For 1, for default installs, the version 
> > number is part of the directory name (for default installs, what most 
> > people have). For 3, the version number is in the registry key we query. So 
> > in most cases we shouldn't have to look at cl.exe itself. And for the cases 
> > where we would have to look, maybe it's ok to require an explicit 
> > fmsc-version flag.
> The version number in the directory name and the registry is the version 
> number of Visual Studio not of the compiler.  Yes, we could do a mapping (VS 
> 14 comes bundled with CL 19), assuming Microsoft continues to keep VS 
> releases and compiler releases in sync, and it means this code will forever 
> need updates to the mapping data.
> 
> The mapping would give just the major version number, which might be all that 
> matters now, but if there's ever a CL 19.1 that has different compatibility 
> requirements (and is maybe released out-of-band with Visual Studio), we'd be 
> stuck.
> 
> Getting the actual version from the compiler seems the most accurate and 
> future-proof way to check.  If that's too expensive, then maybe we should 
> abandon the idea of detecting the default for compatibility.
I'll do some research to figure out the actual costs.  I suspect that walking 
the PATH for the executable may be far more expensive, but I'll get some 
numbers and report back.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-11 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:478
@@ +477,3 @@
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeW(ClExeWide.c_str(),
+  nullptr);

thakis wrote:
> amccarth wrote:
> > amccarth wrote:
> > > thakis wrote:
> > > > amccarth wrote:
> > > > > Yes, it looks in the executable (which I tried to emphasize with the 
> > > > > method name).
> > > > > 
> > > > > I don't think this is very expensive given that Explorer often makes 
> > > > > zillions of such calls, but I'm open to other suggestions.
> > > > > 
> > > > > I know that you can't use a library that's newer than the compiler 
> > > > > (because it may use new language features), but I don't know if that 
> > > > > applies in the other direction or how we would safely and reliably 
> > > > > map directory names to library versions and therefore to compiler 
> > > > > versions.
> > > > I agree that figuring out the right value for fmsc-version 
> > > > automatically somehow is definitely something we should do.
> > > > 
> > > > I forgot that `getVisualStudioBinariesFolder` already works by looking 
> > > > for cl.exe in PATH, so cl.exe's metadata is already warmed up in the 
> > > > disk cache. However, GetFileVersionInfoW() probably opens cl.exe itself 
> > > > and does some PE parsing to get at the version, and that probably is in 
> > > > cold cache territory. 
> > > > (https://msdn.microsoft.com/en-us/library/windows/desktop/ms647003(v=vs.85).aspx
> > > >  suggests that this function might open several files).
> > > > 
> > > > `getVisualStudioBinariesFolder` checks:
> > > > 
> > > > 1. getenv("VCINSTALLDIR")
> > > > 2. cl.exe in getenv("PATH")
> > > > 3. registry (via getVisualStudioInstallDir)
> > > > 
> > > > The common cases are 1 and 3. For 1, for default installs, the version 
> > > > number is part of the directory name (for default installs, what most 
> > > > people have). For 3, the version number is in the registry key we 
> > > > query. So in most cases we shouldn't have to look at cl.exe itself. And 
> > > > for the cases where we would have to look, maybe it's ok to require an 
> > > > explicit fmsc-version flag.
> > > The version number in the directory name and the registry is the version 
> > > number of Visual Studio not of the compiler.  Yes, we could do a mapping 
> > > (VS 14 comes bundled with CL 19), assuming Microsoft continues to keep VS 
> > > releases and compiler releases in sync, and it means this code will 
> > > forever need updates to the mapping data.
> > > 
> > > The mapping would give just the major version number, which might be all 
> > > that matters now, but if there's ever a CL 19.1 that has different 
> > > compatibility requirements (and is maybe released out-of-band with Visual 
> > > Studio), we'd be stuck.
> > > 
> > > Getting the actual version from the compiler seems the most accurate and 
> > > future-proof way to check.  If that's too expensive, then maybe we should 
> > > abandon the idea of detecting the default for compatibility.
> > I'll do some research to figure out the actual costs.  I suspect that 
> > walking the PATH for the executable may be far more expensive, but I'll get 
> > some numbers and report back.
> Compilers being released independently of VC versions and fractional compat 
> numbers sounds like things we can worry about when they happen (probably not 
> soon, right?).
> 
> We already walk PATH, so that wouldn't be an additional cost.
> 
> Be sure to measure cold disk cache perf impact (which is tricky on Windows 
> since there's as far as I know no way to tell the OS to drop its caches). As 
> far as I know file metadata is stored with the directory node on NTFS, so 
> stating files doesn't warm up file content accesses.
> Compilers being released independently of VC versions and fractional compat 
> numbers sounds like things we can worry about when they happen (probably not 
> soon, right?).

It already happens.  Herb Sutter talks about it in one of his blogs:  "Soon 
after VC++11 ships we have announced we will do out-of-band releases for 
additional C++11 conformance which will naturally also include more C11 
features that are in the C subset of C++11."  In this case, it's just the build 
number (of major.minor.build) that's updating, but it's for increasing 
conformance, which is exactly a compatibility issue.

> We already walk PATH, so that wouldn't be an additional cost.

I suspect we may be walking it more than once, which can be expensive even if 
the cache is all warmed up.  This is one of the things I'm checking.  If it's a 
problem, I'll propose a patch to cache the result from the first walk.

> stating files doesn't warm up file content accesses.

That is correct.


http://reviews.llvm.org/D20136



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

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-11 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:478
@@ +477,3 @@
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeW(ClExeWide.c_str(),
+  nullptr);

amccarth wrote:
> thakis wrote:
> > amccarth wrote:
> > > amccarth wrote:
> > > > thakis wrote:
> > > > > amccarth wrote:
> > > > > > Yes, it looks in the executable (which I tried to emphasize with 
> > > > > > the method name).
> > > > > > 
> > > > > > I don't think this is very expensive given that Explorer often 
> > > > > > makes zillions of such calls, but I'm open to other suggestions.
> > > > > > 
> > > > > > I know that you can't use a library that's newer than the compiler 
> > > > > > (because it may use new language features), but I don't know if 
> > > > > > that applies in the other direction or how we would safely and 
> > > > > > reliably map directory names to library versions and therefore to 
> > > > > > compiler versions.
> > > > > I agree that figuring out the right value for fmsc-version 
> > > > > automatically somehow is definitely something we should do.
> > > > > 
> > > > > I forgot that `getVisualStudioBinariesFolder` already works by 
> > > > > looking for cl.exe in PATH, so cl.exe's metadata is already warmed up 
> > > > > in the disk cache. However, GetFileVersionInfoW() probably opens 
> > > > > cl.exe itself and does some PE parsing to get at the version, and 
> > > > > that probably is in cold cache territory. 
> > > > > (https://msdn.microsoft.com/en-us/library/windows/desktop/ms647003(v=vs.85).aspx
> > > > >  suggests that this function might open several files).
> > > > > 
> > > > > `getVisualStudioBinariesFolder` checks:
> > > > > 
> > > > > 1. getenv("VCINSTALLDIR")
> > > > > 2. cl.exe in getenv("PATH")
> > > > > 3. registry (via getVisualStudioInstallDir)
> > > > > 
> > > > > The common cases are 1 and 3. For 1, for default installs, the 
> > > > > version number is part of the directory name (for default installs, 
> > > > > what most people have). For 3, the version number is in the registry 
> > > > > key we query. So in most cases we shouldn't have to look at cl.exe 
> > > > > itself. And for the cases where we would have to look, maybe it's ok 
> > > > > to require an explicit fmsc-version flag.
> > > > The version number in the directory name and the registry is the 
> > > > version number of Visual Studio not of the compiler.  Yes, we could do 
> > > > a mapping (VS 14 comes bundled with CL 19), assuming Microsoft 
> > > > continues to keep VS releases and compiler releases in sync, and it 
> > > > means this code will forever need updates to the mapping data.
> > > > 
> > > > The mapping would give just the major version number, which might be 
> > > > all that matters now, but if there's ever a CL 19.1 that has different 
> > > > compatibility requirements (and is maybe released out-of-band with 
> > > > Visual Studio), we'd be stuck.
> > > > 
> > > > Getting the actual version from the compiler seems the most accurate 
> > > > and future-proof way to check.  If that's too expensive, then maybe we 
> > > > should abandon the idea of detecting the default for compatibility.
> > > I'll do some research to figure out the actual costs.  I suspect that 
> > > walking the PATH for the executable may be far more expensive, but I'll 
> > > get some numbers and report back.
> > Compilers being released independently of VC versions and fractional compat 
> > numbers sounds like things we can worry about when they happen (probably 
> > not soon, right?).
> > 
> > We already walk PATH, so that wouldn't be an additional cost.
> > 
> > Be sure to measure cold disk cache perf impact (which is tricky on Windows 
> > since there's as far as I know no way to tell the OS to drop its caches). 
> > As far as I know file metadata is stored with the directory node on NTFS, 
> > so stating files doesn't warm up file content accesses.
> > Compilers being released independently of VC versions and fractional compat 
> > numbers sounds like things we can worry about when they happen (probably 
> > not soon, right?).
> 
> It already happens.  Herb Sutter talks about it in one of his blogs:  "Soon 
> after VC++11 ships we have announced we will do out-of-band releases for 
> additional C++11 conformance which will naturally also include more C11 
> features that are in the C subset of C++11."  In this case, it's just the 
> build number (of major.minor.build) that's updating, but it's for increasing 
> conformance, which is exactly a compatibility issue.
> 
> > We already walk PATH, so that wouldn't be an additional cost.
> 
> I suspect we may be walking it more than once, which can be expensive even if 
> the cache is all warmed up.  This is one of the things I'm checking.  If it's 
> a problem, I'll propose a patch to cache the result from the first walk.
> 
> > stating files doesn't warm up file content accesses.
> 
> That i

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-12 Thread Adrian McCarthy via cfe-commits
amccarth added a comment.

Are there any remaining concerns with this patch?  Is everyone satisfied with 
the performance numbers?


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth marked 2 inline comments as done.


Comment at: lib/Driver/MSVCToolChain.cpp:42
@@ -40,1 +41,3 @@
+
+  #pragma comment(lib, "version.lib")
 #endif

aaron.ballman wrote:
> Eh, I am lightening up on this sort of thing, so this is fine by me.
I was following the pattern I saw in llvm\lib\Support\Windows\Path.inc (and 
elsewhere), so I thought it was the way we did things around here.


Comment at: lib/Driver/MSVCToolChain.cpp:483
@@ +482,3 @@
+  }
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

aaron.ballman wrote:
> Pure pedantry: `uint8_t` instead of `char`, or is this data really a textual 
> string in practice?
It's a mix.  The part we're looking at is binary data, but the rest of the 
block is text.

I though the API wanted a pointer to char, so I chose `char` to avoid 
unnecessary casts.

But I must've misread the reference page, because just now I double-checked and 
I see that the API wants a void pointer, so I'll go ahead and use `uint8_t`, 
which satisfies my inner pedant as well.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth updated this revision to Diff 57196.
amccarth marked an inline comment as done.
amccarth added a comment.

Addressed additional comments.


http://reviews.llvm.org/D20136

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h
  test/Driver/cl-options.c
  test/Driver/msc-version.c
  test/Driver/msvc-triple.c
  test/Misc/diag-format.c

Index: test/Misc/diag-format.c
===
--- test/Misc/diag-format.c
+++ test/Misc/diag-format.c
@@ -37,7 +37,7 @@
 // DEFAULT: {{.*}}:36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2010: {{.*}}(36,7) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2013: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
-// MSVC: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
+// MSVC: {{.*}}(36,8){{ ?}}: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015: {{.*}}(36,8): warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // VI: {{.*}} +36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015_ORIG: {{.*}}(36): warning: extra tokens at end of #endif directive [-Wextra-tokens]
Index: test/Driver/msvc-triple.c
===
--- test/Driver/msvc-triple.c
+++ test/Driver/msvc-triple.c
@@ -1,9 +1,7 @@
-// RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
 // RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19
 // RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19
 // RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT
 
-// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0"
 // TARGET-19:   target triple = "i686-pc-windows-msvc19.0.0"
 // OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0"
-// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf"
+// ELF-DEFAULT: target triple = "i686-pc-windows-msvc{{.*}}-elf"
Index: test/Driver/msc-version.c
===
--- test/Driver/msc-version.c
+++ test/Driver/msc-version.c
@@ -1,15 +1,4 @@
 //
-// Verify defaults
-//
-
-// RUN: %clang -target i686-windows -fms-compatibility -dM -E - &1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // NoThreadSafeStatics: "-fno-threadsafe-statics"
 
Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -682,7 +682,8 @@
 
 /// Visual studio tools.
 namespace visualstudio {
-VersionTuple getMSVCVersion(const Driver *D, const llvm::Triple &Triple,
+VersionTuple getMSVCVersion(const Driver *D, const ToolChain &TC,
+const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args, bool IsWindowsMSVC);
 
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -3291,7 +3291,7 @@
   Result.append(UID.begin(), UID.end());
 }
 
-VersionTuple visualstudio::getMSVCVersion(const Driver *D,
+VersionTuple visualstudio::getMSVCVersion(const Driver *D, const ToolChain &TC,
   const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args,
   bool IsWindowsMSVC) {
@@ -,8 +,14 @@
 if (Major || Minor || Micro)
   return VersionTuple(Major, Minor, Micro);
 
-// FIXME: Consider bumping this to 19 (MSVC2015) soon.
-return VersionTuple(18);
+if (IsWindowsMSVC) {
+  VersionTuple MSVT = TC.getMSVCVersionFromExe();
+  if (!MSVT.empty())
+return MSVT;
+
+  // FIXME: Consider bumping this to 19 (MSVC2015) soon.
+  return VersionTuple(18);
+}
   }
   return VersionTuple();
 }
@@ -5224,7 +5230,7 @@
 
   // -fms-compatibility-version=18.00 is default.
   VersionTuple MSVT = visualstudio::getMSVCVersion(
-  &D, getToolChain().getTriple(), Args, IsWindowsMSVC);
+  &D, getToolChain(), getToolChain().getTriple(), Args, IsWindowsMSVC);
   if (!MSVT.empty())
 CmdArgs.push_back(
 Args.MakeArgString("-fms-compatibility-version=" + MSVT.getAsString()));
Index: lib/Driver/ToolChains.h
==

Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/Driver/MSVCToolChain.cpp:481
@@ +480,3 @@
+
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

majnemer wrote:
> It might be nicer to use a `SmallVector`, 
> or whatever `VersionSize` typically is, here to avoid heap allocation in the 
> common case.
What's the cutoff for "small"?  The version block in cl.exe is about 9KB.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
amccarth marked an inline comment as done.


Comment at: lib/Driver/MSVCToolChain.cpp:481
@@ +480,3 @@
+
+  std::vector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,

majnemer wrote:
> amccarth wrote:
> > majnemer wrote:
> > > It might be nicer to use a `SmallVector > > sizeof(VS_FIXEDFILEINFO)>`, or whatever `VersionSize` typically is, here 
> > > to avoid heap allocation in the common case.
> > What's the cutoff for "small"?  The version block in cl.exe is about 9KB.
> Using 10K is probably fine, the default stack size on Windows is a massive 1 
> MB and this function is not reentrant.
My mistake.  It's a smidge over 1KB, (still more than sizeof(VS_FIXEDFILEINFO)) 
so I've make a SmallVector of 2KB.


http://reviews.llvm.org/D20136



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


Re: [PATCH] D20136: Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
This revision was automatically updated to reflect the committed changes.
amccarth marked an inline comment as done.
Closed by commit rL269515: Get default -fms-compatibility-version from cl.exe's 
version (authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D20136?vs=57196&id=57267#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20136

Files:
  cfe/trunk/include/clang/Driver/ToolChain.h
  cfe/trunk/lib/Driver/MSVCToolChain.cpp
  cfe/trunk/lib/Driver/ToolChains.h
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/lib/Driver/Tools.h
  cfe/trunk/test/Driver/cl-options.c
  cfe/trunk/test/Driver/msc-version.c
  cfe/trunk/test/Driver/msvc-triple.c
  cfe/trunk/test/Misc/diag-format.c

Index: cfe/trunk/include/clang/Driver/ToolChain.h
===
--- cfe/trunk/include/clang/Driver/ToolChain.h
+++ cfe/trunk/include/clang/Driver/ToolChain.h
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_DRIVER_TOOLCHAIN_H
 
 #include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/VersionTuple.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Multilib.h"
 #include "clang/Driver/Types.h"
@@ -422,6 +423,10 @@
 
   /// \brief Return sanitizers which are enabled by default.
   virtual SanitizerMask getDefaultSanitizers() const { return 0; }
+
+  /// \brief On Windows, returns the version of cl.exe.  On other platforms,
+  /// returns an empty VersionTuple.
+  virtual VersionTuple getMSVCVersionFromExe() const { return VersionTuple(); }
 };
 
 } // end namespace driver
Index: cfe/trunk/test/Misc/diag-format.c
===
--- cfe/trunk/test/Misc/diag-format.c
+++ cfe/trunk/test/Misc/diag-format.c
@@ -37,7 +37,7 @@
 // DEFAULT: {{.*}}:36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2010: {{.*}}(36,7) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2013: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
-// MSVC: {{.*}}(36,8) : warning: extra tokens at end of #endif directive [-Wextra-tokens]
+// MSVC: {{.*}}(36,8){{ ?}}: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015: {{.*}}(36,8): warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // VI: {{.*}} +36:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
 // MSVC2015_ORIG: {{.*}}(36): warning: extra tokens at end of #endif directive [-Wextra-tokens]
Index: cfe/trunk/test/Driver/msvc-triple.c
===
--- cfe/trunk/test/Driver/msvc-triple.c
+++ cfe/trunk/test/Driver/msvc-triple.c
@@ -1,9 +1,7 @@
-// RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
 // RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19
 // RUN: %clang -target i686-pc-windows-msvc   -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19
 // RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT
 
-// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0"
 // TARGET-19:   target triple = "i686-pc-windows-msvc19.0.0"
 // OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0"
-// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf"
+// ELF-DEFAULT: target triple = "i686-pc-windows-msvc{{.*}}-elf"
Index: cfe/trunk/test/Driver/cl-options.c
===
--- cfe/trunk/test/Driver/cl-options.c
+++ cfe/trunk/test/Driver/cl-options.c
@@ -387,7 +387,7 @@
 // RTTI-NOT: "-fno-rtti"
 
 // thread safe statics are off for versions < 19.
-// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
+// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
 // NoThreadSafeStatics: "-fno-threadsafe-statics"
 
Index: cfe/trunk/test/Driver/msc-version.c
===
--- cfe/trunk/test/Driver/msc-version.c
+++ cfe/trunk/test/Driver/msc-version.c
@@ -1,15 +1,4 @@
 //
-// Verify defaults
-//
-
-// RUN: %clang -target i686-windows -fms-compatibility -dM -E - 
+
+  #pragma comment(lib, "version.lib")
 #endif
 
 using namespace clang::driver;
@@ -457,6 +460,45 @@
   return true;
 }
 
+VersionTuple MSVCToolChain::getMSVCVersionFromExe() const {
+  VersionTuple Version;
+#ifdef USE_WIN32
+  std::string BinPath;
+  if (!getVisualStudioBinariesFolder("", BinPath))
+return Version;
+  SmallString<128> ClExe = BinPath;
+  llvm::sys::path::append(ClExe, "cl.exe");
+
+  std::wstring ClExeWide;
+  if (!llvm::ConvertUTF8toWide(ClExe.c_str(), ClExeWide))
+return Version;
+
+  const DWOR

r269515 - Get default -fms-compatibility-version from cl.exe's version

2016-05-13 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Fri May 13 18:20:11 2016
New Revision: 269515

URL: http://llvm.org/viewvc/llvm-project?rev=269515&view=rev
Log:
Get default -fms-compatibility-version from cl.exe's version

-fms-compatibility-version was defaulting to 18 (VS 2013), which is a pain if 
your environment is pointing to version 19 (VS 2015) libraries.

If cl.exe can be found, this patch uses its version number as the default 
instead. It re-uses the existing code to find the Visual Studio binaries folder 
and WinAPI methods to check its version. You can still explicitly specify a 
compatibility version on the command line. If you don't have cl.exe, this 
should be a no-op and you'll get the old default of 18.

This affected the tests, which assumed that if you didn't specific a version, 
that it would default to 18, but this won't be true for all machines. So a 
couple test cases had to be eliminated and a couple others had to be tweaked to 
allow for various outputs.

Addresses: https://llvm.org/bugs/show_bug.cgi?id=27215

Differential Revision: http://reviews.llvm.org/D20136

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
cfe/trunk/test/Driver/cl-options.c
cfe/trunk/test/Driver/msc-version.c
cfe/trunk/test/Driver/msvc-triple.c
cfe/trunk/test/Misc/diag-format.c

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=269515&r1=269514&r2=269515&view=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri May 13 18:20:11 2016
@@ -11,6 +11,7 @@
 #define LLVM_CLANG_DRIVER_TOOLCHAIN_H
 
 #include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/VersionTuple.h"
 #include "clang/Driver/Action.h"
 #include "clang/Driver/Multilib.h"
 #include "clang/Driver/Types.h"
@@ -422,6 +423,10 @@ public:
 
   /// \brief Return sanitizers which are enabled by default.
   virtual SanitizerMask getDefaultSanitizers() const { return 0; }
+
+  /// \brief On Windows, returns the version of cl.exe.  On other platforms,
+  /// returns an empty VersionTuple.
+  virtual VersionTuple getMSVCVersionFromExe() const { return VersionTuple(); }
 };
 
 } // end namespace driver

Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=269515&r1=269514&r2=269515&view=diff
==
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Fri May 13 18:20:11 2016
@@ -19,6 +19,7 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Process.h"
@@ -37,6 +38,8 @@
 #define NOMINMAX
   #endif
   #include 
+
+  #pragma comment(lib, "version.lib")
 #endif
 
 using namespace clang::driver;
@@ -457,6 +460,45 @@ bool MSVCToolChain::getVisualStudioBinar
   return true;
 }
 
+VersionTuple MSVCToolChain::getMSVCVersionFromExe() const {
+  VersionTuple Version;
+#ifdef USE_WIN32
+  std::string BinPath;
+  if (!getVisualStudioBinariesFolder("", BinPath))
+return Version;
+  SmallString<128> ClExe = BinPath;
+  llvm::sys::path::append(ClExe, "cl.exe");
+
+  std::wstring ClExeWide;
+  if (!llvm::ConvertUTF8toWide(ClExe.c_str(), ClExeWide))
+return Version;
+
+  const DWORD VersionSize = ::GetFileVersionInfoSizeW(ClExeWide.c_str(),
+  nullptr);
+  if (VersionSize == 0)
+return Version;
+
+  SmallVector VersionBlock(VersionSize);
+  if (!::GetFileVersionInfoW(ClExeWide.c_str(), 0, VersionSize,
+ VersionBlock.data()))
+return Version;
+
+  VS_FIXEDFILEINFO *FileInfo = nullptr;
+  UINT FileInfoSize = 0;
+  if (!::VerQueryValueW(VersionBlock.data(), L"\\",
+reinterpret_cast(&FileInfo), &FileInfoSize) 
||
+  FileInfoSize < sizeof(*FileInfo))
+return Version;
+
+  const unsigned Major = (FileInfo->dwFileVersionMS >> 16) & 0x;
+  const unsigned Minor = (FileInfo->dwFileVersionMS  ) & 0x;
+  const unsigned Micro = (FileInfo->dwFileVersionLS >> 16) & 0x;
+
+  Version = VersionTuple(Major, Minor, Micro);
+#endif
+  return Version;
+}
+
 // Get Visual Studio installation directory.
 bool MSVCToolChain::getVisualStudioInstallDir(std::string &path) const {
   // First check the environment variables that vsvars32.bat sets.
@@ -618,7 +660,7 @@ MSVCToolChain::ComputeEffectiveClangTrip
   ToolChain::ComputeEffectiveClangTriple(Args, InputType);
   llvm::Triple Triple(TripleStr);

[PATCH] D20392: [CodeView] Modify emitTypeInformation to use MemoryTypeTableBuilder

2016-05-18 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth added a subscriber: cfe-commits.

A baby step toward translating DIType records to CodeView.

This does not (yet) combine the record length with the record data.  I'm going 
back and forth trying to determine if that's a good idea.

Sorry this took so long to figure out.  Before adding the explicit conversion 
to a StringRef, I was losing trailing zeros in  the implicit conversion to 
StringRef.

http://reviews.llvm.org/D20392

Files:
  lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  lib/CodeGen/AsmPrinter/CodeViewDebug.h

Index: lib/CodeGen/AsmPrinter/CodeViewDebug.h
===
--- lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -20,6 +20,7 @@
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h"
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/IR/DebugInfo.h"
 #include "llvm/IR/DebugLoc.h"
@@ -34,6 +35,7 @@
 /// \brief Collects and handles line tables information in a CodeView format.
 class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
   MCStreamer &OS;
+  codeview::MemoryTypeTableBuilder TypeTable;
 
   /// Represents the most general definition range.
   struct LocalVarDefRange {
Index: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===
--- lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -261,55 +261,30 @@
   // This type info currently only holds function ids for use with inline call
   // frame info. All functions are assigned a simple 'void ()' type. Emit that
   // type here.
-  unsigned ArgListIndex = getNextTypeIndex();
-  OS.AddComment("Type record length");
-  OS.EmitIntValue(ArgListRecord::getLayoutSize(), 2);
-  OS.AddComment("Leaf type: LF_ARGLIST");
-  OS.EmitIntValue(LF_ARGLIST, 2);
-  OS.AddComment("Number of arguments");
-  OS.EmitIntValue(0, 4);
+  ArrayRef NoArgs;
+  ArgListRecord ArgListRec(TypeRecordKind::ArgList, NoArgs);
+  TypeIndex ArgListIndex = TypeTable.writeArgList(ArgListRec);
 
-  unsigned VoidFnTyIdx = getNextTypeIndex();
-  OS.AddComment("Type record length");
-  OS.EmitIntValue(ProcedureRecord::getLayoutSize(), 2);
-  OS.AddComment("Leaf type: LF_PROCEDURE");
-  OS.EmitIntValue(LF_PROCEDURE, 2);
-  OS.AddComment("Return type index");
-  OS.EmitIntValue(TypeIndex::Void().getIndex(), 4);
-  OS.AddComment("Calling convention");
-  OS.EmitIntValue(char(CallingConvention::NearC), 1);
-  OS.AddComment("Function options");
-  OS.EmitIntValue(char(FunctionOptions::None), 1);
-  OS.AddComment("# of parameters");
-  OS.EmitIntValue(0, 2);
-  OS.AddComment("Argument list type index");
-  OS.EmitIntValue(ArgListIndex, 4);
+  ProcedureRecord Procedure(TypeIndex::Void(), CallingConvention::NearC,
+FunctionOptions::None, 0, ArgListIndex);
+  TypeIndex VoidFnTyIdx = TypeTable.writeProcedure(Procedure);
 
   // Emit LF_FUNC_ID records for all inlined subprograms to the type stream.
   // Allocate one type index for each func id.
-  unsigned NextIdx = getNextTypeIndex(InlinedSubprograms.size());
-  (void)NextIdx;
-  assert(NextIdx == FuncIdTypeIndexStart && "func id type indices broken");
   for (auto *SP : InlinedSubprograms) {
+TypeIndex ParentScope = TypeIndex(0);
 StringRef DisplayName = SP->getDisplayName();
-OS.AddComment("Type record length");
-MCSymbol *FuncBegin = MMI->getContext().createTempSymbol(),
- *FuncEnd = MMI->getContext().createTempSymbol();
-OS.emitAbsoluteSymbolDiff(FuncEnd, FuncBegin, 2);
-OS.EmitLabel(FuncBegin);
-OS.AddComment("Leaf type: LF_FUNC_ID");
-OS.EmitIntValue(LF_FUNC_ID, 2);
-
-OS.AddComment("Scope type index");
-OS.EmitIntValue(0, 4);
-OS.AddComment("Function type");
-OS.EmitIntValue(VoidFnTyIdx, 4);
-{
-  OS.AddComment("Function name");
-  emitNullTerminatedSymbolName(OS, DisplayName);
-}
-OS.EmitLabel(FuncEnd);
+FuncIdRecord FuncId(ParentScope, VoidFnTyIdx, DisplayName);
+TypeTable.writeFuncId(FuncId);
   }
+
+  TypeTable.ForEachRecord(
+  [&](TypeIndex Index, const MemoryTypeTableBuilder::Record *R) {
+OS.AddComment("Type record length");
+OS.EmitIntValue(R->size(), 2);
+OS.AddComment("Type record data");
+OS.EmitBytes(StringRef(R->data(), R->size()));
+  });
 }
 
 void CodeViewDebug::emitInlineeFuncIdsAndLines() {


Index: lib/CodeGen/AsmPrinter/CodeViewDebug.h
===
--- lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -20,6 +20,7 @@
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/Debug

[PATCH] D20454: Eliminate unnecessary file access checks in Clang driver on Windows

2016-05-19 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a reviewer: majnemer.
amccarth added a subscriber: cfe-commits.

This fixes the problem where the driver will look for cl.exe.exe while walking 
the PATH.

I looked into changing the Windows implementation of 
llvm::sys::fs::can_execute(), but there wasn't a satisfying way to preserve the 
extra checks for the callers that depend on it.  I also looked into having it 
actually check that the file is an executable, but this seemed to add little 
value at the cost of more file i/o.

http://reviews.llvm.org/D20454

Files:
  lib/Driver/MSVCToolChain.cpp

Index: lib/Driver/MSVCToolChain.cpp
===
--- lib/Driver/MSVCToolChain.cpp
+++ lib/Driver/MSVCToolChain.cpp
@@ -408,7 +408,10 @@
 
 SmallString<128> FilePath(PathSegment);
 llvm::sys::path::append(FilePath, "cl.exe");
-if (llvm::sys::fs::can_execute(FilePath.c_str()) &&
+// Checking if cl.exe exists is a small optimization over calling
+// can_execute, which really only checks for existence but will also do
+// extra checks for cl.exe.exe.  These add up when walking a long path.
+if (llvm::sys::fs::exists(FilePath.c_str()) &&
 !llvm::sys::fs::equivalent(FilePath.c_str(), clangProgramPath)) {
   // If we found it on the PATH, use it exactly as is with no
   // modifications.


Index: lib/Driver/MSVCToolChain.cpp
===
--- lib/Driver/MSVCToolChain.cpp
+++ lib/Driver/MSVCToolChain.cpp
@@ -408,7 +408,10 @@
 
 SmallString<128> FilePath(PathSegment);
 llvm::sys::path::append(FilePath, "cl.exe");
-if (llvm::sys::fs::can_execute(FilePath.c_str()) &&
+// Checking if cl.exe exists is a small optimization over calling
+// can_execute, which really only checks for existence but will also do
+// extra checks for cl.exe.exe.  These add up when walking a long path.
+if (llvm::sys::fs::exists(FilePath.c_str()) &&
 !llvm::sys::fs::equivalent(FilePath.c_str(), clangProgramPath)) {
   // If we found it on the PATH, use it exactly as is with no
   // modifications.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r270226 - Eliminate unnecessary file access checks in Clang driver on Windows

2016-05-20 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Fri May 20 10:46:23 2016
New Revision: 270226

URL: http://llvm.org/viewvc/llvm-project?rev=270226&view=rev
Log:
Eliminate unnecessary file access checks in Clang driver on Windows

Differential Revision: http://reviews.llvm.org/D20454

Modified:
cfe/trunk/lib/Driver/MSVCToolChain.cpp

Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=270226&r1=270225&r2=270226&view=diff
==
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Fri May 20 10:46:23 2016
@@ -408,7 +408,10 @@ bool MSVCToolChain::getVisualStudioBinar
 
 SmallString<128> FilePath(PathSegment);
 llvm::sys::path::append(FilePath, "cl.exe");
-if (llvm::sys::fs::can_execute(FilePath.c_str()) &&
+// Checking if cl.exe exists is a small optimization over calling
+// can_execute, which really only checks for existence but will also do
+// extra checks for cl.exe.exe.  These add up when walking a long path.
+if (llvm::sys::fs::exists(FilePath.c_str()) &&
 !llvm::sys::fs::equivalent(FilePath.c_str(), clangProgramPath)) {
   // If we found it on the PATH, use it exactly as is with no
   // modifications.


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


Re: [PATCH] D20454: Eliminate unnecessary file access checks in Clang driver on Windows

2016-05-20 Thread Adrian McCarthy via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270226: Eliminate unnecessary file access checks in Clang 
driver on Windows (authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D20454?vs=57872&id=57936#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20454

Files:
  cfe/trunk/lib/Driver/MSVCToolChain.cpp

Index: cfe/trunk/lib/Driver/MSVCToolChain.cpp
===
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp
@@ -408,7 +408,10 @@
 
 SmallString<128> FilePath(PathSegment);
 llvm::sys::path::append(FilePath, "cl.exe");
-if (llvm::sys::fs::can_execute(FilePath.c_str()) &&
+// Checking if cl.exe exists is a small optimization over calling
+// can_execute, which really only checks for existence but will also do
+// extra checks for cl.exe.exe.  These add up when walking a long path.
+if (llvm::sys::fs::exists(FilePath.c_str()) &&
 !llvm::sys::fs::equivalent(FilePath.c_str(), clangProgramPath)) {
   // If we found it on the PATH, use it exactly as is with no
   // modifications.


Index: cfe/trunk/lib/Driver/MSVCToolChain.cpp
===
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp
@@ -408,7 +408,10 @@
 
 SmallString<128> FilePath(PathSegment);
 llvm::sys::path::append(FilePath, "cl.exe");
-if (llvm::sys::fs::can_execute(FilePath.c_str()) &&
+// Checking if cl.exe exists is a small optimization over calling
+// can_execute, which really only checks for existence but will also do
+// extra checks for cl.exe.exe.  These add up when walking a long path.
+if (llvm::sys::fs::exists(FilePath.c_str()) &&
 !llvm::sys::fs::equivalent(FilePath.c_str(), clangProgramPath)) {
   // If we found it on the PATH, use it exactly as is with no
   // modifications.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r266887 - Add warning about CR+LF line endings on Windows.

2016-04-20 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Wed Apr 20 11:43:34 2016
New Revision: 266887

URL: http://llvm.org/viewvc/llvm-project?rev=266887&view=rev
Log:
Add warning about CR+LF line endings on Windows.

s/checkout/check out/ when used as a verb.

Differential Revision: http://reviews.llvm.org/D19285

Modified:
cfe/trunk/www/get_started.html

Modified: cfe/trunk/www/get_started.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/get_started.html?rev=266887&r1=266886&r2=266887&view=diff
==
--- cfe/trunk/www/get_started.html (original)
+++ cfe/trunk/www/get_started.html Wed Apr 20 11:43:34 2016
@@ -47,20 +47,20 @@ follows:
   http://www.cmake.org/download
   
 
-  Checkout LLVM:
+  Check out LLVM:
   
 Change directory to where you want the llvm directory placed.
 svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
   
   
-  Checkout Clang:
+  Check out Clang:
   
 cd llvm/tools
 svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
 cd ../..
   
   
-  Checkout extra Clang Tools: (optional)
+  Check out extra Clang tools: (optional)
   
 cd llvm/tools/clang/tools
 svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk
@@ -68,7 +68,7 @@ follows:
 cd ../../../..
   
   
-  Checkout Compiler-RT (optional):
+  Check out Compiler-RT (optional):
   
 cd llvm/projects
 svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk
@@ -76,7 +76,7 @@ follows:
 cd ../..
   
   
-  Checkout libcxx: (only required to build and run Compiler-RT tests on OS 
X, optional otherwise)
+  Check out libcxx: (only required to build and run Compiler-RT tests on 
OS X, optional otherwise)
   
 cd llvm/projects
 svn co http://llvm.org/svn/llvm-project/libcxx/trunk
@@ -124,13 +124,13 @@ follows:
 checkout is at the same revision as your Clang checkout. LLVM's interfaces
 change over time, and mismatched revisions are not expected to work
 together.
-  
+
 Simultaneously Building Clang and LLVM:
 
 Once you have checked out Clang into the llvm source tree it will build 
along
 with the rest of llvm. To build all of LLVM and Clang together all at
 once simply run make from the root LLVM directory.
-
+
 Note: Observe that Clang is technically part of a separate
 Subversion repository. As mentioned above, the latest Clang sources are tied to
 the latest sources in the LLVM tree. You can update your toplevel LLVM project
@@ -169,16 +169,19 @@ Visual Studio:
   
   
 
-  Checkout LLVM:
+  Check out LLVM:
   
 svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
   
   
-  Checkout Clang:
+  Check out Clang:
   
  cd llvm\tools
  svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
   
+  Note:  Some Clang tests are sensitive to the line endings.  
Ensure
+ that checking out the files does not convert LF line endings to CR+LF.
+ If you use git-svn, make sure your core.autocrlf setting is 
false.
   
   Run CMake to generate the Visual Studio solution and project files:
   


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


[PATCH] D21107: Generate codeview for array types

2016-06-07 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth added a subscriber: cfe-commits.

Creates codeview type records for arrays and adds a simple test for one.



http://reviews.llvm.org/D21107

Files:
  lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  lib/CodeGen/AsmPrinter/CodeViewDebug.h
  test/DebugInfo/COFF/types-array.ll

Index: test/DebugInfo/COFF/types-array.ll
===
--- /dev/null
+++ test/DebugInfo/COFF/types-array.ll
@@ -0,0 +1,122 @@
+; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s
+
+; C++ source to regenerate:
+; $ cat t.cpp
+; void usevars(int, ...);
+; void f(float p1, double p2, long long p3) {
+;   int a[5] = {9, 4, 5, 4, 2};
+;   usevars(a[0], a);
+; }
+; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
+
+; CHECK: CodeViewTypes [
+; CHECK:   Section: .debug$T (6)
+; CHECK:   Magic: 0x4
+; CHECK:   ArgList (0x1000) {
+; CHECK: TypeLeafKind: LF_ARGLIST (0x1201)
+; CHECK: NumArgs: 3
+; CHECK: Arguments [
+; CHECK:   ArgType: float (0x40)
+; CHECK:   ArgType: double (0x41)
+; CHECK:   ArgType: __int64 (0x13)
+; CHECK: ]
+; CHECK:   }
+; CHECK:   Procedure (0x1001) {
+; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
+; CHECK: ReturnType: void (0x3)
+; CHECK: CallingConvention: NearC (0x0)
+; CHECK: FunctionOptions [ (0x0)
+; CHECK: ]
+; CHECK: NumParameters: 3
+; CHECK: ArgListType: (float, double, __int64) (0x1000)
+; CHECK:   }
+; CHECK:   FuncId (0x1002) {
+; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
+; CHECK: ParentScope: 0x0
+; CHECK: FunctionType: void (float, double, __int64) (0x1001)
+; CHECK: Name: f
+; CHECK:   }
+; CHECK:   Array (0x1003) {
+; CHECK: TypeLeafKind: LF_ARRAY (0x1503)
+; CHECK: ElementType: int (0x74)
+; CHECK: IndexType: unsigned (0x75)
+; CHECK: SizeOf: 20
+; CHECK: Name:
+; CHECK:   }
+; CHECK: ]
+
+; ModuleID = 't.cpp'
+source_filename = "t.cpp"
+target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
+target triple = "i686-pc-windows-msvc19.0.23918"
+
+@"\01?a@?1??f@@YAXMN_J@Z@3PAHA" = private unnamed_addr constant [5 x i32] [i32 9, i32 4, i32 5, i32 4, i32 2], align 4
+
+define void @"\01?f@@YAXMN_J@Z"(float %p1, double %p2, i64 %p3) #0 !dbg !6 {
+entry:
+  %p3.addr = alloca i64, align 8
+  %p2.addr = alloca double, align 8
+  %p1.addr = alloca float, align 4
+  %a = alloca [5 x i32], align 4
+  store i64 %p3, i64* %p3.addr, align 8
+  call void @llvm.dbg.declare(metadata i64* %p3.addr, metadata !12, metadata !13), !dbg !14
+  store double %p2, double* %p2.addr, align 8
+  call void @llvm.dbg.declare(metadata double* %p2.addr, metadata !15, metadata !13), !dbg !16
+  store float %p1, float* %p1.addr, align 4
+  call void @llvm.dbg.declare(metadata float* %p1.addr, metadata !17, metadata !13), !dbg !18
+  call void @llvm.dbg.declare(metadata [5 x i32]* %a, metadata !19, metadata !13), !dbg !24
+  %0 = bitcast [5 x i32]* %a to i8*, !dbg !24
+  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* bitcast ([5 x i32]* @"\01?a@?1??f@@YAXMN_J@Z@3PAHA" to i8*), i32 20, i32 4, i1 false), !dbg !24
+  %arraydecay = getelementptr inbounds [5 x i32], [5 x i32]* %a, i32 0, i32 0, !dbg !25
+  %arrayidx = getelementptr inbounds [5 x i32], [5 x i32]* %a, i32 0, i32 0, !dbg !26
+  %1 = load i32, i32* %arrayidx, align 4, !dbg !26
+  call void (i32, ...) @"\01?usevars@@YAXHZZ"(i32 %1, i32* %arraydecay), !dbg !27
+  ret void, !dbg !28
+}
+
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+
+; Function Attrs: argmemonly nounwind
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) #2
+
+declare void @"\01?usevars@@YAXHZZ"(i32, ...) #3
+
+attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone }
+attributes #2 = { argmemonly nounwind }
+attributes #3 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+!llvm.ident = !{!5}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cllvm\5Ctest\5CDebugInfo\5CCOFF")
+!2 = !{}
+!3 = !{i32 2

Re: [PATCH] D21107: Generate codeview for array types

2016-06-07 Thread Adrian McCarthy via cfe-commits
amccarth added inline comments.


Comment at: lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:785
@@ +784,3 @@
+  TypeIndex IndexType = Asm->MAI->getPointerSize() == 8 ?
+  TypeIndex(SimpleTypeKind::UInt64) :
+  TypeIndex(SimpleTypeKind::UInt32);

majnemer wrote:
> They don't use UInt64Quad? Surprising.
That's an excellent question.  Let me check it out.


http://reviews.llvm.org/D21107



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


[PATCH] D21705: Include debug info for nested structs and classes

2016-06-24 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth added a subscriber: cfe-commits.

This includes nested types in the member list, even if there are no members of 
that type.  Note that structs and classes have themselves as an "implicit 
struct" as the first member, so we skip implicit ones.

Most of the work (for me) was figuring out the tests that broke as a result of 
the ordering changes.  In particular, please scrutinize the Objective C one, 
which doesn't actually nest a struct but has a member function with a pointer 
to an incomplete struct type.

http://reviews.llvm.org/D21705

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
  test/CodeGenCXX/debug-info-indirect-field-decl.cpp
  test/CodeGenCXX/debug-info-ms-abi.cpp
  test/CodeGenObjCXX/debug-info-cyclic.mm

Index: test/CodeGenObjCXX/debug-info-cyclic.mm
===
--- test/CodeGenObjCXX/debug-info-cyclic.mm
+++ test/CodeGenObjCXX/debug-info-cyclic.mm
@@ -8,7 +8,7 @@
 // CHECK-NOT:  DIFlagFwdDecl
 // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]]
 // CHECK-SAME: identifier:
-// CHECK: ![[BMEMBERS]] = !{![[BB:[0-9]+]]}
+// CHECK: ![[BMEMBERS]] = !{![[A:[0-9]+]], ![[BB:[0-9]+]]}
   B(struct A *);
 // CHECK: ![[BB]] = !DISubprogram(name: "B", scope: ![[B]]
 // CHECK-SAME:line: [[@LINE-2]],
Index: test/CodeGenCXX/debug-info-ms-abi.cpp
===
--- test/CodeGenCXX/debug-info-ms-abi.cpp
+++ test/CodeGenCXX/debug-info-ms-abi.cpp
@@ -14,6 +14,9 @@
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
 // CHECK-SAME: identifier: ".?AUFoo@@"
 
+// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
+// CHECK-SAME: identifier: ".?AUNested@Foo@@"
+
 // CHECK: !DISubprogram(name: "f",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
@@ -25,6 +28,3 @@
 // CHECK: !DISubprogram(name: "h",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
-
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
-// CHECK-SAME: identifier: ".?AUNested@Foo@@"
Index: test/CodeGenCXX/debug-info-indirect-field-decl.cpp
===
--- test/CodeGenCXX/debug-info-indirect-field-decl.cpp
+++ test/CodeGenCXX/debug-info-indirect-field-decl.cpp
@@ -8,18 +8,18 @@
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
-  // CHECK-SAME:   line: [[@LINE+4]]
-  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
-  // CHECK-SAME:   size: 32, align: 32, offset: 32
-  // CHECK: ![[UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
   union {
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2",
-// CHECK-SAME:   line: [[@LINE+5]]
+// CHECK-SAME:   line: [[@LINE+9]]
 // CHECK-SAME:   baseType: ![[INT]]
 // CHECK-SAME:   size: 32, align: 32
 // CHECK-NOT:offset:
 // CHECK-SAME:   ){{$}}
+// CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
+// CHECK-SAME:   line: [[@LINE-8]]
+// CHECK-SAME:   baseType: ![[UNION]]
+// CHECK-SAME:   size: 32, align: 32, offset: 32
 int i2;
   };
 };
Index: test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
===
--- test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
+++ test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
@@ -19,6 +19,6 @@
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -249,6 +249,8 @@
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
  

Re: [PATCH] D21705: Include debug info for nested structs and classes

2016-06-29 Thread Adrian McCarthy via cfe-commits
amccarth marked 2 inline comments as done.
amccarth added a comment.

http://reviews.llvm.org/D21705



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


Re: [PATCH] D21705: Include debug info for nested structs and classes

2016-06-29 Thread Adrian McCarthy via cfe-commits
amccarth updated this revision to Diff 62283.
amccarth added a comment.

Applied suggestion from the comments, which eliminates the need to alter the 
ObjectiveC test.


http://reviews.llvm.org/D21705

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
  test/CodeGenCXX/debug-info-indirect-field-decl.cpp
  test/CodeGenCXX/debug-info-ms-abi.cpp

Index: test/CodeGenCXX/debug-info-ms-abi.cpp
===
--- test/CodeGenCXX/debug-info-ms-abi.cpp
+++ test/CodeGenCXX/debug-info-ms-abi.cpp
@@ -14,6 +14,9 @@
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
 // CHECK-SAME: identifier: ".?AUFoo@@"
 
+// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
+// CHECK-SAME: identifier: ".?AUNested@Foo@@"
+
 // CHECK: !DISubprogram(name: "f",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
@@ -25,6 +28,3 @@
 // CHECK: !DISubprogram(name: "h",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
-
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
-// CHECK-SAME: identifier: ".?AUNested@Foo@@"
Index: test/CodeGenCXX/debug-info-indirect-field-decl.cpp
===
--- test/CodeGenCXX/debug-info-indirect-field-decl.cpp
+++ test/CodeGenCXX/debug-info-indirect-field-decl.cpp
@@ -8,18 +8,18 @@
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
-  // CHECK-SAME:   line: [[@LINE+4]]
-  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
-  // CHECK-SAME:   size: 32, align: 32, offset: 32
-  // CHECK: ![[UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
   union {
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2",
-// CHECK-SAME:   line: [[@LINE+5]]
+// CHECK-SAME:   line: [[@LINE+9]]
 // CHECK-SAME:   baseType: ![[INT]]
 // CHECK-SAME:   size: 32, align: 32
 // CHECK-NOT:offset:
 // CHECK-SAME:   ){{$}}
+// CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
+// CHECK-SAME:   line: [[@LINE-8]]
+// CHECK-SAME:   baseType: ![[UNION]]
+// CHECK-SAME:   size: 32, align: 32, offset: 32
 int i2;
   };
 };
Index: test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
===
--- test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
+++ test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
@@ -19,6 +19,6 @@
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -249,6 +249,8 @@
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -1028,6 +1028,13 @@
   elements.push_back(fieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1064,6 +1071,9 @@
 
 // Bump field number for next field.
 ++fieldNo;
+  } else if (const auto *nestedRec = dyn_cast(I)) {
+if (!nestedRec->isImplicit() && nestedRec->getDeclContext() == record)
+  CollectRecordNestedRecord(nestedRec, elements);
   }
   }
 }
@@ -3562,8 +3572,8 @@
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const Namespace

r274628 - Include debug info for nested structs and classes

2016-07-06 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Wed Jul  6 09:46:42 2016
New Revision: 274628

URL: http://llvm.org/viewvc/llvm-project?rev=274628&view=rev
Log:
Include debug info for nested structs and classes

This includes nested types in the member list, even if there are no members of 
that type. Note that structs and classes have themselves as an "implicit 
struct" as the first member, so we skip implicit ones.

Differential Revision: http://reviews.llvm.org/D21705

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274628&r1=274627&r2=274628&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jul  6 09:46:42 2016
@@ -1095,6 +1095,13 @@ void CGDebugInfo::CollectRecordNormalFie
   elements.push_back(FieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1131,6 +1138,9 @@ void CGDebugInfo::CollectRecordFields(
 
 // Bump field number for next field.
 ++fieldNo;
+  } else if (const auto *nestedRec = dyn_cast(I)) {
+if (!nestedRec->isImplicit() && nestedRec->getDeclContext() == record)
+  CollectRecordNestedRecord(nestedRec, elements);
   }
   }
 }
@@ -3633,8 +3643,8 @@ void CGDebugInfo::EmitUsingDirective(con
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() || 
-  CGM.getCodeGenOpts().DebugExplicitImport) { 
+  if (!NSDecl->isAnonymousNamespace() ||
+  CGM.getCodeGenOpts().DebugExplicitImport) {
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=274628&r1=274627&r2=274628&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jul  6 09:46:42 2016
@@ -254,6 +254,8 @@ class CGDebugInfo {
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=274628&r1=274627&r2=274628&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Wed Jul  6 09:46:42 
2016
@@ -19,6 +19,6 @@ protected:
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"

Modified: cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp?rev=274628&r1=274627&r2=274628&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp Wed Jul  6 
09:46:42 2016
@@ -8,18 +8,18 @@ template  class Fo
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
-  // CHECK-SAME:   line: [[@LINE+4]]
-  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
-  // CHECK-SAME:   size: 32, align: 32, offset: 32
-  // CHECK: ![[UNION]] = distinct !DICompositeType(tag: 
DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: ![[UNION:[0

Re: [PATCH] D21705: Include debug info for nested structs and classes

2016-07-06 Thread Adrian McCarthy via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274628: Include debug info for nested structs and classes 
(authored by amccarth).

Changed prior to commit:
  http://reviews.llvm.org/D21705?vs=62283&id=62869#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21705

Files:
  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
  cfe/trunk/lib/CodeGen/CGDebugInfo.h
  cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
  cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
  cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Index: cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
===
--- cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
+++ cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
@@ -14,6 +14,9 @@
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
 // CHECK-SAME: identifier: ".?AUFoo@@"
 
+// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
+// CHECK-SAME: identifier: ".?AUNested@Foo@@"
+
 // CHECK: !DISubprogram(name: "f",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
@@ -25,6 +28,3 @@
 // CHECK: !DISubprogram(name: "h",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
-
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
-// CHECK-SAME: identifier: ".?AUNested@Foo@@"
Index: cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
===
--- cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
+++ cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
@@ -8,18 +8,18 @@
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
-  // CHECK-SAME:   line: [[@LINE+4]]
-  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
-  // CHECK-SAME:   size: 32, align: 32, offset: 32
-  // CHECK: ![[UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
   union {
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2",
-// CHECK-SAME:   line: [[@LINE+5]]
+// CHECK-SAME:   line: [[@LINE+9]]
 // CHECK-SAME:   baseType: ![[INT]]
 // CHECK-SAME:   size: 32, align: 32
 // CHECK-NOT:offset:
 // CHECK-SAME:   ){{$}}
+// CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
+// CHECK-SAME:   line: [[@LINE-8]]
+// CHECK-SAME:   baseType: ![[UNION]]
+// CHECK-SAME:   size: 32, align: 32, offset: 32
 int i2;
   };
 };
Index: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
===
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
@@ -19,6 +19,6 @@
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
===
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
@@ -1095,6 +1095,13 @@
   elements.push_back(FieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1131,6 +1138,9 @@
 
 // Bump field number for next field.
 ++fieldNo;
+  } else if (const auto *nestedRec = dyn_cast(I)) {
+if (!nestedRec->isImplicit() && nestedRec->getDeclContext() == record)
+  CollectRecordNestedRecord(nestedRec, elements);
   }
   }
 }
@@ -3633,8 +3643,8 @@
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() || 
-  CGM.getCodeGenOpts().DebugExplicitImport) { 
+  if (!NSDecl->isAnonymousNamespace() ||
+  CGM.getCodeGenOpts().DebugExplicitImport) {
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),
In

r274633 - Revert "Include debug info for nested structs and classes"

2016-07-06 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Wed Jul  6 10:15:38 2016
New Revision: 274633

URL: http://llvm.org/viewvc/llvm-project?rev=274633&view=rev
Log:
Revert "Include debug info for nested structs and classes"

This reverts commit 0af5ee9631c7c167dc40498b415876553e314c95.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274633&r1=274632&r2=274633&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jul  6 10:15:38 2016
@@ -1095,13 +1095,6 @@ void CGDebugInfo::CollectRecordNormalFie
   elements.push_back(FieldType);
 }
 
-void CGDebugInfo::CollectRecordNestedRecord(
-const RecordDecl *RD, SmallVectorImpl &elements) {
-  QualType Ty = CGM.getContext().getTypeDeclType(RD);
-  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
-  elements.push_back(nestedType);
-}
-
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1138,9 +1131,6 @@ void CGDebugInfo::CollectRecordFields(
 
 // Bump field number for next field.
 ++fieldNo;
-  } else if (const auto *nestedRec = dyn_cast(I)) {
-if (!nestedRec->isImplicit() && nestedRec->getDeclContext() == record)
-  CollectRecordNestedRecord(nestedRec, elements);
   }
   }
 }
@@ -3643,8 +3633,8 @@ void CGDebugInfo::EmitUsingDirective(con
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() ||
-  CGM.getCodeGenOpts().DebugExplicitImport) {
+  if (!NSDecl->isAnonymousNamespace() || 
+  CGM.getCodeGenOpts().DebugExplicitImport) { 
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=274633&r1=274632&r2=274633&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jul  6 10:15:38 2016
@@ -254,8 +254,6 @@ class CGDebugInfo {
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
-  void CollectRecordNestedRecord(const RecordDecl *RD,
- SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=274633&r1=274632&r2=274633&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Wed Jul  6 10:15:38 
2016
@@ -19,6 +19,6 @@ protected:
 
 Test t;
 
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
 // CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"

Modified: cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp?rev=274633&r1=274632&r2=274633&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp Wed Jul  6 
10:15:38 2016
@@ -8,18 +8,18 @@ template  class Fo
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: 
DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
+  // CHECK-SAME:   line: [[@LINE+4]]
+  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
+  // CHECK-SAME:   size: 32, align: 32, offset: 32
+  // CHECK: ![[UNION]] = distinct !DICompositeType(tag: 
DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
   union {
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2",
-//

Re: r274633 - Revert "Include debug info for nested structs and classes"

2016-07-06 Thread Adrian McCarthy via cfe-commits
Reverted because this depended upon an LLVM patch that was reverted because
of test failures on the buildbots.  I'm still investigating the root cause.

SVN revision was rL274628.

On Wed, Jul 6, 2016 at 8:15 AM, Adrian McCarthy via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: amccarth
> Date: Wed Jul  6 10:15:38 2016
> New Revision: 274633
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274633&view=rev
> Log:
> Revert "Include debug info for nested structs and classes"
>
> This reverts commit 0af5ee9631c7c167dc40498b415876553e314c95.
>
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> cfe/trunk/lib/CodeGen/CGDebugInfo.h
> cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
> cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
> cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274633&r1=274632&r2=274633&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jul  6 10:15:38 2016
> @@ -1095,13 +1095,6 @@ void CGDebugInfo::CollectRecordNormalFie
>elements.push_back(FieldType);
>  }
>
> -void CGDebugInfo::CollectRecordNestedRecord(
> -const RecordDecl *RD, SmallVectorImpl &elements) {
> -  QualType Ty = CGM.getContext().getTypeDeclType(RD);
> -  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
> -  elements.push_back(nestedType);
> -}
> -
>  void CGDebugInfo::CollectRecordFields(
>  const RecordDecl *record, llvm::DIFile *tunit,
>  SmallVectorImpl &elements,
> @@ -1138,9 +1131,6 @@ void CGDebugInfo::CollectRecordFields(
>
>  // Bump field number for next field.
>  ++fieldNo;
> -  } else if (const auto *nestedRec = dyn_cast(I)) {
> -if (!nestedRec->isImplicit() && nestedRec->getDeclContext() ==
> record)
> -  CollectRecordNestedRecord(nestedRec, elements);
>}
>}
>  }
> @@ -3643,8 +3633,8 @@ void CGDebugInfo::EmitUsingDirective(con
>if (CGM.getCodeGenOpts().getDebugInfo() <
> codegenoptions::LimitedDebugInfo)
>  return;
>const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
> -  if (!NSDecl->isAnonymousNamespace() ||
> -  CGM.getCodeGenOpts().DebugExplicitImport) {
> +  if (!NSDecl->isAnonymousNamespace() ||
> +  CGM.getCodeGenOpts().DebugExplicitImport) {
>  DBuilder.createImportedModule(
>  getCurrentContextDescriptor(cast(UD.getDeclContext())),
>  getOrCreateNameSpace(NSDecl),
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=274633&r1=274632&r2=274633&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jul  6 10:15:38 2016
> @@ -254,8 +254,6 @@ class CGDebugInfo {
>  llvm::DIFile *F,
>  SmallVectorImpl &E,
>  llvm::DIType *RecordTy, const RecordDecl
> *RD);
> -  void CollectRecordNestedRecord(const RecordDecl *RD,
> - SmallVectorImpl &E);
>void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
> SmallVectorImpl &E,
> llvm::DICompositeType *RecordTy);
>
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=274633&r1=274632&r2=274633&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Wed Jul  6
> 10:15:38 2016
> @@ -19,6 +19,6 @@ protected:
>
>  Test t;
>
> -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
>  // CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
> +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
>  // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
>
> Modified: cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp?rev=274633&r1=274632&r

r274698 - Retry "Include debug info for nested structs and classes"

2016-07-06 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Wed Jul  6 17:39:15 2016
New Revision: 274698

URL: http://llvm.org/viewvc/llvm-project?rev=274698&view=rev
Log:
Retry "Include debug info for nested structs and classes"

This should work now that the LLVM-side of the change has landed successfully.

Original Differential Revision: http://reviews.llvm.org/D21705

This reverts commit a30322e861c387e1088f47065d0438c6bb019879.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274698&r1=274697&r2=274698&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jul  6 17:39:15 2016
@@ -1095,6 +1095,13 @@ void CGDebugInfo::CollectRecordNormalFie
   elements.push_back(FieldType);
 }
 
+void CGDebugInfo::CollectRecordNestedRecord(
+const RecordDecl *RD, SmallVectorImpl &elements) {
+  QualType Ty = CGM.getContext().getTypeDeclType(RD);
+  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
+  elements.push_back(nestedType);
+}
+
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1131,6 +1138,9 @@ void CGDebugInfo::CollectRecordFields(
 
 // Bump field number for next field.
 ++fieldNo;
+  } else if (const auto *nestedRec = dyn_cast(I)) {
+if (!nestedRec->isImplicit() && nestedRec->getDeclContext() == record)
+  CollectRecordNestedRecord(nestedRec, elements);
   }
   }
 }
@@ -3633,8 +3643,8 @@ void CGDebugInfo::EmitUsingDirective(con
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() || 
-  CGM.getCodeGenOpts().DebugExplicitImport) { 
+  if (!NSDecl->isAnonymousNamespace() ||
+  CGM.getCodeGenOpts().DebugExplicitImport) {
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=274698&r1=274697&r2=274698&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jul  6 17:39:15 2016
@@ -254,6 +254,8 @@ class CGDebugInfo {
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=274698&r1=274697&r2=274698&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Wed Jul  6 17:39:15 
2016
@@ -19,6 +19,6 @@ protected:
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"

Modified: cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp?rev=274698&r1=274697&r2=274698&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp Wed Jul  6 
17:39:15 2016
@@ -8,18 +8,18 @@ template  class Fo
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
-  // CHECK-SAME:   line: [[@LINE+4]]
-  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
-  // CHECK-SAME:   size: 32, align: 32, offset: 32
-  // CHECK: ![[UNION]] = distinct !DICompositeType(tag: 
DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: 
DW_TAG_un

r274706 - Revert "Retry "Include debug info for nested structs and classes""

2016-07-06 Thread Adrian McCarthy via cfe-commits
Author: amccarth
Date: Wed Jul  6 18:28:34 2016
New Revision: 274706

URL: http://llvm.org/viewvc/llvm-project?rev=274706&view=rev
Log:
Revert "Retry "Include debug info for nested structs and classes""

Reverting because it causes a test failure on build bots 
(Modules/ModuleDebugInfo.cpp).  Failure does not reproduce locally.

svn revision: rL274698

This reverts commit 3c5ed6599b086720aab5b8bd6941149d066806a6.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274706&r1=274705&r2=274706&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jul  6 18:28:34 2016
@@ -1095,13 +1095,6 @@ void CGDebugInfo::CollectRecordNormalFie
   elements.push_back(FieldType);
 }
 
-void CGDebugInfo::CollectRecordNestedRecord(
-const RecordDecl *RD, SmallVectorImpl &elements) {
-  QualType Ty = CGM.getContext().getTypeDeclType(RD);
-  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
-  elements.push_back(nestedType);
-}
-
 void CGDebugInfo::CollectRecordFields(
 const RecordDecl *record, llvm::DIFile *tunit,
 SmallVectorImpl &elements,
@@ -1138,9 +1131,6 @@ void CGDebugInfo::CollectRecordFields(
 
 // Bump field number for next field.
 ++fieldNo;
-  } else if (const auto *nestedRec = dyn_cast(I)) {
-if (!nestedRec->isImplicit() && nestedRec->getDeclContext() == record)
-  CollectRecordNestedRecord(nestedRec, elements);
   }
   }
 }
@@ -3643,8 +3633,8 @@ void CGDebugInfo::EmitUsingDirective(con
   if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo)
 return;
   const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
-  if (!NSDecl->isAnonymousNamespace() ||
-  CGM.getCodeGenOpts().DebugExplicitImport) {
+  if (!NSDecl->isAnonymousNamespace() || 
+  CGM.getCodeGenOpts().DebugExplicitImport) { 
 DBuilder.createImportedModule(
 getCurrentContextDescriptor(cast(UD.getDeclContext())),
 getOrCreateNameSpace(NSDecl),

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=274706&r1=274705&r2=274706&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jul  6 18:28:34 2016
@@ -254,8 +254,6 @@ class CGDebugInfo {
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
-  void CollectRecordNestedRecord(const RecordDecl *RD,
- SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
llvm::DICompositeType *RecordTy);

Modified: cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp?rev=274706&r1=274705&r2=274706&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp Wed Jul  6 18:28:34 
2016
@@ -19,6 +19,6 @@ protected:
 
 Test t;
 
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
 // CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"

Modified: cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp?rev=274706&r1=274705&r2=274706&view=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp Wed Jul  6 
18:28:34 2016
@@ -8,18 +8,18 @@ template  class Fo
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: 
DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
+  // CHECK-SAME:   line: [[@LINE+4]]
+  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
+  // CHECK-SAME:   size: 32, align: 32, offset: 32
+  // CHECK: ![[UNION]] = distinc

Re: r274628 - Include debug info for nested structs and classes

2016-07-07 Thread Adrian McCarthy via cfe-commits
This patch was reverted because it breaks a test on the buildbots (that
I've been unable to reproduce locally), so that's why you didn't seen
anything.  I'll try again to land the patch once I can fix and verify that
test.

This patch is one part of the change.  The other part is
http://reviews.llvm.org/D21939, which ensures this extra info is carried
through for CodeView debug info.

I'm not familiar with DWARF type units (but am currently reading about
them).  I don't immediately see how this change would affect the
calculation of the type signature.

The intent is to ensure that there is a type record for Bar in code like
this:

struct Foo {
  struct Bar {};
};

Without this change, Bar is omitted from the debug info metadata.


On Thu, Jul 7, 2016 at 4:03 PM, David Blaikie  wrote:

> This may cause problems for DWARF type unit consistency...
>
> Under what conditions do nested types appear in the member list? (my
> simple test case on a fresh clang didn't seem to produce anything about the
> nested type: struct outer { struct inner { int i; }; int j; }; outer o; )
>
> On Wed, Jul 6, 2016 at 7:46 AM, Adrian McCarthy via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: amccarth
>> Date: Wed Jul  6 09:46:42 2016
>> New Revision: 274628
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=274628&view=rev
>> Log:
>> Include debug info for nested structs and classes
>>
>> This includes nested types in the member list, even if there are no
>> members of that type. Note that structs and classes have themselves as an
>> "implicit struct" as the first member, so we skip implicit ones.
>>
>> Differential Revision: http://reviews.llvm.org/D21705
>>
>> Modified:
>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> cfe/trunk/lib/CodeGen/CGDebugInfo.h
>> cfe/trunk/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
>> cfe/trunk/test/CodeGenCXX/debug-info-indirect-field-decl.cpp
>> cfe/trunk/test/CodeGenCXX/debug-info-ms-abi.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=274628&r1=274627&r2=274628&view=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Jul  6 09:46:42 2016
>> @@ -1095,6 +1095,13 @@ void CGDebugInfo::CollectRecordNormalFie
>>elements.push_back(FieldType);
>>  }
>>
>> +void CGDebugInfo::CollectRecordNestedRecord(
>> +const RecordDecl *RD, SmallVectorImpl &elements) {
>> +  QualType Ty = CGM.getContext().getTypeDeclType(RD);
>> +  llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile());
>> +  elements.push_back(nestedType);
>> +}
>> +
>>  void CGDebugInfo::CollectRecordFields(
>>  const RecordDecl *record, llvm::DIFile *tunit,
>>  SmallVectorImpl &elements,
>> @@ -1131,6 +1138,9 @@ void CGDebugInfo::CollectRecordFields(
>>
>>  // Bump field number for next field.
>>  ++fieldNo;
>> +  } else if (const auto *nestedRec = dyn_cast(I)) {
>> +if (!nestedRec->isImplicit() && nestedRec->getDeclContext() ==
>> record)
>> +  CollectRecordNestedRecord(nestedRec, elements);
>>}
>>}
>>  }
>> @@ -3633,8 +3643,8 @@ void CGDebugInfo::EmitUsingDirective(con
>>if (CGM.getCodeGenOpts().getDebugInfo() <
>> codegenoptions::LimitedDebugInfo)
>>  return;
>>const NamespaceDecl *NSDecl = UD.getNominatedNamespace();
>> -  if (!NSDecl->isAnonymousNamespace() ||
>> -  CGM.getCodeGenOpts().DebugExplicitImport) {
>> +  if (!NSDecl->isAnonymousNamespace() ||
>> +  CGM.getCodeGenOpts().DebugExplicitImport) {
>>  DBuilder.createImportedModule(
>>  getCurrentContextDescriptor(cast(UD.getDeclContext())),
>>  getOrCreateNameSpace(NSDecl),
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=274628&r1=274627&r2=274628&view=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Jul  6 09:46:42 2016
>> @@ -254,6 +254,8 @@ class CGDebugInfo {
>>  llvm::DIFile *F,
>>  SmallVectorImpl &E,
>&

[clang] 6e77a67 - Fix clang Visual Studio build instructions

2021-04-20 Thread Adrian McCarthy via cfe-commits

Author: Alessandro Vergani
Date: 2021-04-20T11:17:29-07:00
New Revision: 6e77a67171e68d9eda811799d5b1c2530282478e

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

LOG: Fix clang Visual Studio build instructions

Change cd ..\.. to cd llvm-project (the former is probably a leftover
of the old svn instructions)

Committer: Adrian McCarthy 

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

Added: 


Modified: 
clang/www/get_started.html

Removed: 




diff  --git a/clang/www/get_started.html b/clang/www/get_started.html
index 4c5a3976a6ad..aacf55af8f57 100755
--- a/clang/www/get_started.html
+++ b/clang/www/get_started.html
@@ -137,7 +137,7 @@ Using Visual Studio
   
   Run CMake to generate the Visual Studio solution and project files:
   
-cd ..\..  (back to where you started)
+cd llvm-project
 mkdir build (for building without polluting the source 
dir)
 cd build
 



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