[PATCH] D53329: Generate DIFile with main program if source is not available

2018-12-27 Thread Yonghong Song via Phabricator via cfe-commits
yonghong-song added a comment.

I found an easy way to reproduce the issue and also did some preliminary 
analysis. I have filed a bug https://bugs.llvm.org/show_bug.cgi?id=40170. The 
reproducible case and my analysis is  below:

-bash-4.4$ cat ttest2.c
#include "ttest.h"

BPF_PERF_OUTPUT2(probe);

int main() { return g; }
-bash-4.4$ cat ttest.h

#define BPF_PERF_OUTPUT2(_name) \
struct _name##_table_t { \

  int key; \
  unsigned leaf; \
  int (*perf_submit) (void *, void *, unsigned); \
  int (*perf_submit_skb) (void *, unsigned, void *, unsigned); \
  unsigned max_entries; \

}; \
__attribute__((section("maps/perf_output"))) \
struct _name##_table_t _name = { .max_entries = 0 }

int g;
-bash-4.4$ clang -g -O2 -gdwarf-5 -gembed-source -c ttest2.c
inconsistent use of embedded source
fatal error: error in backend: Broken module found, compilation aborted!
clang-8: error: clang frontend command failed with exit code 70 (use -v to see 
invocation)
clang version 8.0.0 (trunk 350092) (llvm/trunk 350084)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/yhs/work/llvm/build/install/bin
clang-8: note: diagnostic msg: PLEASE submit a bug report to 
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, 
and associated run script.
clang-8: note: diagnostic msg:



PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-8: note: diagnostic msg: /tmp/ttest2-6c497a.c
clang-8: note: diagnostic msg: /tmp/ttest2-6c497a.sh
clang-8: note: diagnostic msg:



-bash-4.4$

Basically, a simple C file and header file. The C file contains a macro 
expansion. Compiling with -g -gdwarf-5 -gembed-source will cause the
compiler complains:

  fatal error: error in backend: Broken module found, compilation aborted!

When I tried to root cause the bug described in 
https://reviews.llvm.org/D53329, I found a simple test case like the above will 
break clang.

I did some analysis. The following are rough reason.

1. Looks like for macro in the source code, the clang actually will create a 
"FileID" for it. The FileID is not associated with a file. It is actually 
associated with a source location range.
2. In my particular example, the macro defines a global variable and the global

variable needs a file.

3. When clang tries to find the FileID based on source location of the global 
variable, it found a source expansion FileID which does not have source 
associated with it.
4. So clang simply does not have a "source" attribute for the DIFile 
corresponding to the global as in (3) it does not have such information.
5. Later on, IR verification complains embed-source is enabled but all not

DIFile has sources, so aborted.

My above workaround is obviously incorrect. But I am not sure what is the 
correct way to fix this issue. Maybe one of you can help. Thanks!


Repository:
  rC Clang

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

https://reviews.llvm.org/D53329



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


[PATCH] D56116: [gn build] Make `ninja check-clang` also run Clang's unit tests

2018-12-27 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.
thakis added a reviewer: phosek.
Herald added a subscriber: arphaman.

Also add a build file for clang/lib/ASTMatchers/Dynamic, which is only needed 
by tests (and clang/tools/extra).

With this, the build files for //clang are complete.

-

I'm sending this out before it's 100% done. Open questions:

- If a new unit test binary gets added to the CMake build, it's easy to miss 
that in the GN build and the only effect is that the tests silently don't get 
run. I want to make the sync script check that the number of unit test binaries 
match somehow.
- target_out_dir is kind of a weird place to put the tests: 
out/gn/obj/clang/unittests/Format/FormatTests (etc). The CMake build for an SVN 
checkout puts them at ./tools/clang/unittests/Format/FormatTests which is weird 
too (I haven't checked the CMake build for a git build yet; that'd be 
interesting). Maybe putting them all in out/gn/bin/unittests could work? It 
looks like the unit test binary names try to be unique across all LLVM projects 
– but it'd be a pretty big difference from a CMake build, so I don't like that. 
out/gn/bin/unittests/{lld,clang,llvm}/FormatTests could work, but the every 
project would need its own test() macro, which is kind of lame too. So maybe 
it's fine as is, but it makes it pretty annoying to run test binaries manually, 
so I kind of feel it's not fine as is.
- Probably want a test() macro.
- The bigobj FIXME is silly. We should pass /bigobj globally. For the CMake 
build too.


https://reviews.llvm.org/D56116

Files:
  llvm/utils/gn/secondary/clang/lib/ASTMatchers/Dynamic/BUILD.gn
  llvm/utils/gn/secondary/clang/test/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/AST/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/ASTMatchers/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/ASTMatchers/Dynamic/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Analysis/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Basic/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/CodeGen/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/CrossTU/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Driver/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Format/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Frontend/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Index/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Lex/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Rename/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Rewrite/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Sema/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/StaticAnalyzer/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn
  llvm/utils/gn/secondary/clang/unittests/libclang/BUILD.gn

Index: llvm/utils/gn/secondary/clang/unittests/libclang/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/unittests/libclang/BUILD.gn
@@ -0,0 +1,17 @@
+executable("libclangTests") {
+  # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest
+  output_dir = target_out_dir
+
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang/tools/libclang",
+"//llvm/utils/unittest/UnitTestMain",
+  ]
+  sources = [
+"LibclangTest.cpp",
+  ]
+  if (host_os == "mac") {
+ldflags = [ "-Wl,-rpath," + rebase_path("$root_out_dir/lib") ]
+  }
+  testonly = true
+}
Index: llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/unittests/Tooling/BUILD.gn
@@ -0,0 +1,64 @@
+executable("ToolingTests") {
+  # test/Unit/lit.cfg expects unittests in CLANG_BINARY_DIR/unittest
+  output_dir = target_out_dir
+
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  include_dirs = [ "." ]
+  deps = [
+"//clang/lib/AST",
+"//clang/lib/ASTMatchers",
+"//clang/lib/Basic",
+"//clang/lib/Format",
+"//clang/lib/Frontend",
+"//clang/lib/Lex",
+"//clang/lib/Rewrite",
+"//clang/lib/Tooling",
+"//clang/lib/Tooling/Core",
+"//clang/lib/Tooling/Refactoring",
+"//llvm/lib/Support",
+"//llvm/lib/Target:TargetsToBuild",
+"//llvm/utils/unittest/UnitTestMain",
+  ]
+  sources = [
+"ASTSelectionTest.cpp",
+"CastExprTest.cpp",
+"CommentHandlerTest.cpp",
+"CompilationDatabaseTest.cpp",
+"DiagnosticsYamlTest.cpp",
+"ExecutionTest.cpp",
+"FixItTest.cpp",
+"HeaderIncludesTest.cpp",
+"LexicallyOrderedRecursiveASTVisitorTest.cpp",
+"LookupTest.cpp",
+"QualTypeNamesTest.cpp",
+"RecursiveASTVisitorTestDeclVisitor.cpp",
+"RecursiveASTVisitorTestPostOrderVisitor.cpp",
+"RecursiveASTVisitorTestTypeLocVisitor.cpp",
+"RecursiveASTVisitorTests/Attr.cpp",
+"RecursiveASTVisitorTests/CXXBoolLiteralExpr.cpp",
+"RecursiveASTVisitorTests/CXXMemberCall.cpp",
+"RecursiveASTVisitorTests/CXX

[PATCH] D47817: [compiler-rt] [sanitizer_common] Remove support for tirpc/rpc/xdr.h

2018-12-27 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka added a comment.

In D47817#1341490 , @krytarowski wrote:

> Looks good to me, but I will let a Linux person to accept it.


LGTM as well, but would be nice to have input from @ygribov who added this code.


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

https://reviews.llvm.org/D47817



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


Re: r347339 - [clang][Parse] Diagnose useless null statements / empty init-statements

2018-12-27 Thread Nico Weber via cfe-commits
Should this be in -Wextra-semi? It seems weird to have to pass both
-Wextra-semi and -Wextra-semi-stmt.

(Also, we generally try to not add DefaultIgnore warnings. I think this is
a useful warning though, and other than others in this thread I think it'd
be good to have -Wextra-semi in -Wall. But I don't feel strongly about that
part.)

On Tue, Nov 20, 2018 at 2:01 PM Roman Lebedev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: lebedevri
> Date: Tue Nov 20 10:59:05 2018
> New Revision: 347339
>
> URL: http://llvm.org/viewvc/llvm-project?rev=347339&view=rev
> Log:
> [clang][Parse] Diagnose useless null statements / empty init-statements
>
> Summary:
> clang has `-Wextra-semi` (D43162), which is not dictated by the currently
> selected standard.
> While that is great, there is at least one more source of need-less semis
> - 'null statements'.
> Sometimes, they are needed:
> ```
> for(int x = 0; continueToDoWork(x); x++)
>   ; // Ugly code, but the semi is needed here.
> ```
>
> But sometimes they are just there for no reason:
> ```
> switch(X) {
> case 0:
>   return -2345;
> case 5:
>   return 0;
> default:
>   return 42;
> }; // <- oops
>
> ;;; <- PS, still not diagnosed. Clearly this is junk.
> ```
>
> Additionally:
> ```
> if(; // <- empty init-statement
>true)
>   ;
>
> switch (; // empty init-statement
> x) {
>   ...
> }
>
> for (; // <- empty init-statement
>  int y : S())
>   ;
> }
>
> As usual, things may or may not go sideways in the presence of macros.
> While evaluating this diag on my codebase of interest, it was
> unsurprisingly
> discovered that Google Test macros are *very* prone to this.
> And it seems many issues are deep within the GTest itself, not
> in the snippets passed from the codebase that uses GTest.
>
> So after some thought, i decided not do issue a diagnostic if the semi
> is within *any* macro, be it either from the normal header, or system
> header.
>
> Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=39111 | PR39111 ]]
>
> Reviewers: rsmith, aaron.ballman, efriedma
>
> Reviewed By: aaron.ballman
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D52695
>
> Added:
>
> cfe/trunk/test/Parser/extra-semi-resulting-in-nullstmt-in-init-statement.cpp
> cfe/trunk/test/Parser/extra-semi-resulting-in-nullstmt.cpp
> Modified:
> cfe/trunk/docs/ReleaseNotes.rst
> cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
> cfe/trunk/include/clang/Parse/Parser.h
> cfe/trunk/lib/Parse/ParseExprCXX.cpp
> cfe/trunk/lib/Parse/ParseStmt.cpp
>
> Modified: cfe/trunk/docs/ReleaseNotes.rst
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=347339&r1=347338&r2=347339&view=diff
>
> ==
> --- cfe/trunk/docs/ReleaseNotes.rst (original)
> +++ cfe/trunk/docs/ReleaseNotes.rst Tue Nov 20 10:59:05 2018
> @@ -55,6 +55,63 @@ Major New Features
>  Improvements to Clang's diagnostics
>  ^^^
>
> +- ``-Wextra-semi-stmt`` is a new diagnostic that diagnoses extra
> semicolons,
> +  much like ``-Wextra-semi``. This new diagnostic diagnoses all
> *unnecessary*
> +  null statements (expression statements without an expression), unless:
> the
> +  semicolon directly follows a macro that was expanded to nothing or if
> the
> +  semicolon is within the macro itself. This applies to macros defined in
> system
> +  headers as well as user-defined macros.
> +
> +  .. code-block:: c++
> +
> +  #define MACRO(x) int x;
> +  #define NULLMACRO(varname)
> +
> +  void test() {
> +; // <- warning: ';' with no preceding expression is a null
> statement
> +
> +while (true)
> +  ; // OK, it is needed.
> +
> +switch (my_enum) {
> +case E1:
> +  // stuff
> +  break;
> +case E2:
> +  ; // OK, it is needed.
> +}
> +
> +MACRO(v0;) // Extra semicolon, but within macro, so ignored.
> +
> +MACRO(v1); // <- warning: ';' with no preceding expression is a
> null statement
> +
> +NULLMACRO(v2); // ignored, NULLMACRO expanded to nothing.
> +  }
> +
> +- ``-Wempty-init-stmt`` is a new diagnostic that diagnoses empty
> init-statements
> +  of ``if``, ``switch``, ``range-based for``, unless: the semicolon
> directly
> +  follows a macro that was expanded to nothing or if the semicolon is
> within the
> +  macro itself (both macros from system headers, and normal macros). This
> +  diagnostic is in the ``-Wextra-semi-stmt`` group and is enabled in
> +  ``-Wextra``.
> +
> +  .. code-block:: c++
> +
> +  void test() {
> +if(; // <- warning: init-statement of 'if' is a null statement
> +   true)
> +  ;
> +
> +switch (; // <- warning: init-statement of 'switch' is a null
> statement
> +x) {
> +  ...
>

[PATCH] D56095: [gn build] Add check-clang target and make it work

2018-12-27 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350108: [gn build] Add check-clang target and make it work 
(authored by nico, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56095?vs=179563&id=179590#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56095

Files:
  llvm/trunk/utils/gn/secondary/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/test/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang/test/clang_lit_site_cfg_files.gni
  llvm/trunk/utils/gn/secondary/llvm/triples.gni
  llvm/trunk/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn

Index: llvm/trunk/utils/gn/secondary/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/BUILD.gn
@@ -3,22 +3,8 @@
 
 group("default") {
   deps = [
-":clang",
-"//clang/tools/c-index-test",
-"//clang/tools/clang-diff",
-"//clang/tools/clang-format",
-"//clang/tools/clang-import-test",
-"//clang/tools/clang-refactor",
-"//clang/tools/clang-rename",
-"//clang/tools/diagtool",
-"//clang/utils/hmaptool",
+"//clang/test",
 "//lld/test",
-"//llvm/tools/llvm-cat",
-"//llvm/tools/llvm-lto",
-"//llvm/tools/llvm-lto2",
-"//llvm/tools/llvm-modextract",
-"//llvm/tools/llvm-profdata",
-"//llvm/tools/llvm-symbolizer:symlinks",
 "//llvm/tools/llvm-undname",
   ]
   if (clang_enable_arcmt) {
Index: llvm/trunk/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
@@ -1,3 +1,4 @@
+import("//clang/test/clang_lit_site_cfg_files.gni")
 import("//lld/test/lld_lit_site_cfg_files.gni")
 
 action("llvm-lit") {
@@ -27,11 +28,17 @@
   config_map = ""
 
   deps += [
+"//clang/test:lit_site_cfg",
+"//clang/test:lit_unit_site_cfg",
 "//lld/test:lit_site_cfg",
 "//lld/test:lit_unit_site_cfg",
   ]
 
   # Note: \n is converted into a newline by write_cmake_config.py, not by gn.
+  config_map += "map_config('" + rebase_path("//clang/test/lit.cfg.py") +
+"', '" + rebase_path(clang_lit_site_cfg_file) + "')\n"
+  config_map += "map_config('" + rebase_path("//clang/test/Unit/lit.cfg.py") +
+"', '" + rebase_path(clang_lit_unit_site_cfg_file) + "')\n"
   config_map += "map_config('" + rebase_path("//lld/test/lit.cfg.py") + "', '" +
 rebase_path(lld_lit_site_cfg_file) + "')\n"
   config_map += "map_config('" + rebase_path("//lld/test/Unit/lit.cfg.py") +
Index: llvm/trunk/utils/gn/secondary/llvm/triples.gni
===
--- llvm/trunk/utils/gn/secondary/llvm/triples.gni
+++ llvm/trunk/utils/gn/secondary/llvm/triples.gni
@@ -1,9 +1,13 @@
-if (host_os == "linux") {
-  llvm_host_triple = "x86_64-unknown-linux-gnu"
-} else if (host_os == "mac") {
-  llvm_host_triple = "x86_64-apple-darwin"
-} else if (host_os == "win") {
-  llvm_host_triple = "x86_64-pc-windows"
+if (host_cpu == "x64") {
+  if (host_os == "linux") {
+llvm_host_triple = "x86_64-unknown-linux-gnu"
+  } else if (host_os == "mac") {
+llvm_host_triple = "x86_64-apple-darwin"
+  } else if (host_os == "win") {
+llvm_host_triple = "x86_64-pc-windows"
+  }
+} else {
+  assert(false, "unimplemented host_cpu " + host_cpu)
 }
 
 declare_args() {
Index: llvm/trunk/utils/gn/secondary/clang/test/clang_lit_site_cfg_files.gni
===
--- llvm/trunk/utils/gn/secondary/clang/test/clang_lit_site_cfg_files.gni
+++ llvm/trunk/utils/gn/secondary/clang/test/clang_lit_site_cfg_files.gni
@@ -0,0 +1,2 @@
+clang_lit_site_cfg_file = "$root_gen_dir/clang/test/lit.site.cfg.py"
+clang_lit_unit_site_cfg_file = "$root_gen_dir/clang/test/Unit/lit.site.cfg.py"
Index: llvm/trunk/utils/gn/secondary/clang/test/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang/test/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang/test/BUILD.gn
@@ -0,0 +1,195 @@
+import("//clang/lib/ARCMigrate/enable.gni")
+import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+import("//llvm/lib/Target/targets.gni")
+import("//llvm/triples.gni")
+import("//llvm/utils/gn/build/libs/zlib/enable.gni")
+import("clang_lit_site_cfg_files.gni")
+
+template("write_lit_config") {
+  action(target_name) {
+script = "//llvm/utils/gn/build/write_cmake_config.py"
+
+sources = [
+  invoker.input,
+]
+outputs = [
+  invoker.output,
+]
+args = [
+  "-o",
+  rebase_path(outputs[0], root_out_dir),
+  rebase_path(sources[0], root_out_dir),
+
+  "LIT_SITE_CFG_IN_HEADER=## Autogenerated from ${sources[0]}, do not

[PATCH] D56112: [clang-offload-bundler] Added install component

2018-12-27 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc edited reviewers, added: ABataev, hfinkel; removed: chandlerc.
chandlerc added a comment.

Adding likely more useful reviewers... Not really interesting from a CMake 
perspective.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56112



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


[PATCH] D56109: [sanitizer_common] Define __sanitizer_FILE on NetBSD

2018-12-27 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added inline comments.



Comment at: lib/sanitizer_common/sanitizer_common_interceptors.inc:5698
+#if SANITIZER_NETBSD
+  if (fp->_bf._base)
+COMMON_INTERCEPTOR_INITIALIZE_RANGE(fp->_bf._base,

maybe `if (fp->_bf._base && fp->_bf._size)`


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

https://reviews.llvm.org/D56109



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


[PATCH] D56112: [clang-offload-bundler] Added install component

2018-12-27 Thread Vyacheslav Zakharin via Phabricator via cfe-commits
vzakhari created this revision.
vzakhari added a reviewer: chandlerc.
Herald added subscribers: cfe-commits, mgorny.

Allow selective install of clang-offload-bundler


Repository:
  rC Clang

https://reviews.llvm.org/D56112

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -22,4 +22,7 @@
   ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
   )

-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
+install(TARGETS clang-offload-bundler
+  COMPONENT clang-offload-bundler
+  RUNTIME DESTINATION bin
+  )


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -22,4 +22,7 @@
   ${CLANG_OFFLOAD_BUNDLER_LIB_DEPS}
   )

-install(TARGETS clang-offload-bundler RUNTIME DESTINATION bin)
+install(TARGETS clang-offload-bundler
+  COMPONENT clang-offload-bundler
+  RUNTIME DESTINATION bin
+  )
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47817: [compiler-rt] [sanitizer_common] Remove support for tirpc/rpc/xdr.h

2018-12-27 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

Looks good to me, but I will let a Linux person to accept it.


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

https://reviews.llvm.org/D47817



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


[PATCH] D56109: [sanitizer_common] Define __sanitizer_FILE on NetBSD

2018-12-27 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

As a subtask please add missing calls to `unpoison_file` in interceptors (in 
sanitizer_common_interceptors.inc)


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

https://reviews.llvm.org/D56109



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


[PATCH] D56095: [gn build] Add check-clang target and make it work

2018-12-27 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D56095



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


[PATCH] D56109: [sanitizer_common] Define __sanitizer_FILE on NetBSD

2018-12-27 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 179570.
mgorny marked 2 inline comments as done.

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

https://reviews.llvm.org/D56109

Files:
  lib/sanitizer_common/sanitizer_common_interceptors.inc
  lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
  lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
  lib/tsan/rtl/tsan_interceptors.cc

Index: lib/tsan/rtl/tsan_interceptors.cc
===
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -44,14 +44,8 @@
 #define dirfd(dirp) (*(int *)(dirp))
 #define fileno_unlocked fileno
 
-#if _LP64
-#define __sF_size 152
-#else
-#define __sF_size 88
-#endif
-
-#define stdout ((char*)&__sF + (__sF_size * 1))
-#define stderr ((char*)&__sF + (__sF_size * 2))
+#define stdout ((__sanitizer_FILE*)&__sF[1])
+#define stderr ((__sanitizer_FILE*)&__sF[2])
 
 #define nanosleep __nanosleep50
 #define vfork __vfork14
Index: lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
===
--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
+++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
@@ -446,8 +446,36 @@
   uptr we_nbytes;
 };
 
-typedef char __sanitizer_FILE;
-#define SANITIZER_HAS_STRUCT_FILE 0
+struct __sanitizer_FILE {
+  unsigned char *_p;
+  int _r;
+  int _w;
+  unsigned short _flags;
+  short _file;
+  struct {
+unsigned char *_base;
+int _size;
+  } _bf;
+  int _lbfsize;
+  void *_cookie;
+  int (*_close)(void *ptr);
+  u64 (*_read)(void *, void *, uptr);
+  u64 (*_seek)(void *, u64, int);
+  uptr (*_write)(void *, const void *, uptr);
+  struct {
+unsigned char *_base;
+int _size;
+  } _ext;
+  unsigned char *_up;
+  int _ur;
+  unsigned char _ubuf[3];
+  unsigned char _nbuf[1];
+  int (*_flush)(void *ptr);
+  char _lb_unused[sizeof(uptr)];
+  int _blksize;
+  u64 _offset;
+};
+#define SANITIZER_HAS_STRUCT_FILE 1
 
 extern int shmctl_ipc_stat;
 
Index: lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
===
--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
@@ -2224,6 +2224,29 @@
 CHECK_SIZE_AND_OFFSET(wordexp_t, we_wordv);
 CHECK_SIZE_AND_OFFSET(wordexp_t, we_offs);
 
+COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
+CHECK_SIZE_AND_OFFSET(FILE, _p);
+CHECK_SIZE_AND_OFFSET(FILE, _r);
+CHECK_SIZE_AND_OFFSET(FILE, _w);
+CHECK_SIZE_AND_OFFSET(FILE, _flags);
+CHECK_SIZE_AND_OFFSET(FILE, _file);
+CHECK_SIZE_AND_OFFSET(FILE, _bf);
+CHECK_SIZE_AND_OFFSET(FILE, _lbfsize);
+CHECK_SIZE_AND_OFFSET(FILE, _cookie);
+CHECK_SIZE_AND_OFFSET(FILE, _close);
+CHECK_SIZE_AND_OFFSET(FILE, _read);
+CHECK_SIZE_AND_OFFSET(FILE, _seek);
+CHECK_SIZE_AND_OFFSET(FILE, _write);
+CHECK_SIZE_AND_OFFSET(FILE, _ext);
+CHECK_SIZE_AND_OFFSET(FILE, _up);
+CHECK_SIZE_AND_OFFSET(FILE, _ur);
+CHECK_SIZE_AND_OFFSET(FILE, _ubuf);
+CHECK_SIZE_AND_OFFSET(FILE, _nbuf);
+CHECK_SIZE_AND_OFFSET(FILE, _flush);
+CHECK_SIZE_AND_OFFSET(FILE, _lb_unused);
+CHECK_SIZE_AND_OFFSET(FILE, _blksize);
+CHECK_SIZE_AND_OFFSET(FILE, _offset);
+
 CHECK_TYPE_SIZE(tm);
 CHECK_SIZE_AND_OFFSET(tm, tm_sec);
 CHECK_SIZE_AND_OFFSET(tm, tm_min);
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -5694,9 +5694,15 @@
 void unpoison_file(__sanitizer_FILE *fp) {
 #if SANITIZER_HAS_STRUCT_FILE
   COMMON_INTERCEPTOR_INITIALIZE_RANGE(fp, sizeof(*fp));
+#if SANITIZER_NETBSD
+  if (fp->_bf._base)
+COMMON_INTERCEPTOR_INITIALIZE_RANGE(fp->_bf._base,
+fp->_bf._size);
+#else
   if (fp->_IO_read_base && fp->_IO_read_base < fp->_IO_read_end)
 COMMON_INTERCEPTOR_INITIALIZE_RANGE(fp->_IO_read_base,
 fp->_IO_read_end - fp->_IO_read_base);
+#endif
 #endif  // SANITIZER_HAS_STRUCT_FILE
 }
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56109: [sanitizer_common] Define __sanitizer_FILE on NetBSD

2018-12-27 Thread Michał Górny via Phabricator via cfe-commits
mgorny added inline comments.



Comment at: lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:2249
+CHECK_SIZE_AND_OFFSET(FILE, _offset);
+CHECK_SIZE_AND_OFFSET(FILE, _flags);
+

krytarowski wrote:
> Duplicate with L2231
Fixed.


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

https://reviews.llvm.org/D56109



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


[PATCH] D56109: [sanitizer_common] Define __sanitizer_FILE on NetBSD

2018-12-27 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added inline comments.



Comment at: lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:2249
+CHECK_SIZE_AND_OFFSET(FILE, _offset);
+CHECK_SIZE_AND_OFFSET(FILE, _flags);
+

Duplicate with L2231


Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D56109



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


[PATCH] D56109: [sanitizer_common] Define __sanitizer_FILE on NetBSD

2018-12-27 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
mgorny added reviewers: krytarowski, vitalybuka.
Herald added subscribers: Sanitizers, llvm-commits, kubamracek.

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D56109

Files:
  lib/sanitizer_common/sanitizer_common_interceptors.inc
  lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
  lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
  lib/tsan/rtl/tsan_interceptors.cc

Index: lib/tsan/rtl/tsan_interceptors.cc
===
--- lib/tsan/rtl/tsan_interceptors.cc
+++ lib/tsan/rtl/tsan_interceptors.cc
@@ -44,14 +44,8 @@
 #define dirfd(dirp) (*(int *)(dirp))
 #define fileno_unlocked fileno
 
-#if _LP64
-#define __sF_size 152
-#else
-#define __sF_size 88
-#endif
-
-#define stdout ((char*)&__sF + (__sF_size * 1))
-#define stderr ((char*)&__sF + (__sF_size * 2))
+#define stdout ((__sanitizer_FILE*)&__sF[1])
+#define stderr ((__sanitizer_FILE*)&__sF[2])
 
 #define nanosleep __nanosleep50
 #define vfork __vfork14
Index: lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
===
--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
+++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
@@ -446,8 +446,36 @@
   uptr we_nbytes;
 };
 
-typedef char __sanitizer_FILE;
-#define SANITIZER_HAS_STRUCT_FILE 0
+struct __sanitizer_FILE {
+  unsigned char *_p;
+  int _r;
+  int _w;
+  unsigned short _flags;
+  short _file;
+  struct {
+unsigned char *_base;
+int _size;
+  } _bf;
+  int _lbfsize;
+  void *_cookie;
+  int (*_close)(void *ptr);
+  u64 (*_read)(void *, void *, uptr);
+  u64 (*_seek)(void *, u64, int);
+  uptr (*_write)(void *, const void *, uptr);
+  struct {
+unsigned char *_base;
+int _size;
+  } _ext;
+  unsigned char *_up;
+  int _ur;
+  unsigned char _ubuf[3];
+  unsigned char _nbuf[1];
+  int (*_flush)(void *ptr);
+  char _lb_unused[sizeof(uptr)];
+  int _blksize;
+  u64 _offset;
+};
+#define SANITIZER_HAS_STRUCT_FILE 1
 
 extern int shmctl_ipc_stat;
 
Index: lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
===
--- lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
@@ -2224,6 +2224,30 @@
 CHECK_SIZE_AND_OFFSET(wordexp_t, we_wordv);
 CHECK_SIZE_AND_OFFSET(wordexp_t, we_offs);
 
+COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
+CHECK_SIZE_AND_OFFSET(FILE, _p);
+CHECK_SIZE_AND_OFFSET(FILE, _r);
+CHECK_SIZE_AND_OFFSET(FILE, _w);
+CHECK_SIZE_AND_OFFSET(FILE, _flags);
+CHECK_SIZE_AND_OFFSET(FILE, _file);
+CHECK_SIZE_AND_OFFSET(FILE, _bf);
+CHECK_SIZE_AND_OFFSET(FILE, _lbfsize);
+CHECK_SIZE_AND_OFFSET(FILE, _cookie);
+CHECK_SIZE_AND_OFFSET(FILE, _close);
+CHECK_SIZE_AND_OFFSET(FILE, _read);
+CHECK_SIZE_AND_OFFSET(FILE, _seek);
+CHECK_SIZE_AND_OFFSET(FILE, _write);
+CHECK_SIZE_AND_OFFSET(FILE, _ext);
+CHECK_SIZE_AND_OFFSET(FILE, _up);
+CHECK_SIZE_AND_OFFSET(FILE, _ur);
+CHECK_SIZE_AND_OFFSET(FILE, _ubuf);
+CHECK_SIZE_AND_OFFSET(FILE, _nbuf);
+CHECK_SIZE_AND_OFFSET(FILE, _flush);
+CHECK_SIZE_AND_OFFSET(FILE, _lb_unused);
+CHECK_SIZE_AND_OFFSET(FILE, _blksize);
+CHECK_SIZE_AND_OFFSET(FILE, _offset);
+CHECK_SIZE_AND_OFFSET(FILE, _flags);
+
 CHECK_TYPE_SIZE(tm);
 CHECK_SIZE_AND_OFFSET(tm, tm_sec);
 CHECK_SIZE_AND_OFFSET(tm, tm_min);
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -5694,9 +5694,15 @@
 void unpoison_file(__sanitizer_FILE *fp) {
 #if SANITIZER_HAS_STRUCT_FILE
   COMMON_INTERCEPTOR_INITIALIZE_RANGE(fp, sizeof(*fp));
+#if SANITIZER_NETBSD
+  if (fp->_bf._base)
+COMMON_INTERCEPTOR_INITIALIZE_RANGE(fp->_bf._base,
+fp->_bf._size);
+#else
   if (fp->_IO_read_base && fp->_IO_read_base < fp->_IO_read_end)
 COMMON_INTERCEPTOR_INITIALIZE_RANGE(fp->_IO_read_base,
 fp->_IO_read_end - fp->_IO_read_base);
+#endif
 #endif  // SANITIZER_HAS_STRUCT_FILE
 }
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55915: [Driver] Make -fno-omit-frame-pointer imply -mno-omit-leaf-frame-pointer

2018-12-27 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: test/Driver/cl-options.c:177
 // RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | 
FileCheck -check-prefix=Oy_2 %s
-// Oy_2: -momit-leaf-frame-pointer
+// Oy_2: -mdisable-fp-elim
 // Oy_2: -O2

tabloid.adroit wrote:
> chandlerc wrote:
> > Do we want to also change behavior for the CL options? We should discuss 
> > this w/ the Windows folks at least
> Sure. It would be great to have them to confirm.
> 
I'd say this behavior change is desired. I confirmed it's what MSVC does with 
/Oy-, which is their spelling for this. It also doesn't look like intentional 
behavior that we implemented to optimize size for 32-bit windows, based on this 
list of issues here:
https://bugs.llvm.org/showdependencytree.cgi?id=26299&hide_resolved=0
It has the potential to regress code size on i686-windows-msvc, but I don't 
think 32-bit size really matters at this point. If anything, better stack 
traces would be preferred.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55915



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


[PATCH] D56095: [gn build] Add check-clang target and make it work

2018-12-27 Thread Nico Weber via Phabricator via cfe-commits
thakis updated this revision to Diff 179563.
thakis added a comment.

s/missing/unimplemented/


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

https://reviews.llvm.org/D56095

Files:
  llvm/utils/gn/secondary/BUILD.gn
  llvm/utils/gn/secondary/clang/test/BUILD.gn
  llvm/utils/gn/secondary/clang/test/clang_lit_site_cfg_files.gni
  llvm/utils/gn/secondary/llvm/triples.gni
  llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/utils/llvm-lit/BUILD.gn
@@ -1,3 +1,4 @@
+import("//clang/test/clang_lit_site_cfg_files.gni")
 import("//lld/test/lld_lit_site_cfg_files.gni")
 
 action("llvm-lit") {
@@ -27,11 +28,17 @@
   config_map = ""
 
   deps += [
+"//clang/test:lit_site_cfg",
+"//clang/test:lit_unit_site_cfg",
 "//lld/test:lit_site_cfg",
 "//lld/test:lit_unit_site_cfg",
   ]
 
   # Note: \n is converted into a newline by write_cmake_config.py, not by gn.
+  config_map += "map_config('" + rebase_path("//clang/test/lit.cfg.py") +
+"', '" + rebase_path(clang_lit_site_cfg_file) + "')\n"
+  config_map += "map_config('" + rebase_path("//clang/test/Unit/lit.cfg.py") +
+"', '" + rebase_path(clang_lit_unit_site_cfg_file) + "')\n"
   config_map += "map_config('" + rebase_path("//lld/test/lit.cfg.py") + "', '" +
 rebase_path(lld_lit_site_cfg_file) + "')\n"
   config_map += "map_config('" + rebase_path("//lld/test/Unit/lit.cfg.py") +
Index: llvm/utils/gn/secondary/llvm/triples.gni
===
--- llvm/utils/gn/secondary/llvm/triples.gni
+++ llvm/utils/gn/secondary/llvm/triples.gni
@@ -1,9 +1,13 @@
-if (host_os == "linux") {
-  llvm_host_triple = "x86_64-unknown-linux-gnu"
-} else if (host_os == "mac") {
-  llvm_host_triple = "x86_64-apple-darwin"
-} else if (host_os == "win") {
-  llvm_host_triple = "x86_64-pc-windows"
+if (host_cpu == "x64") {
+  if (host_os == "linux") {
+llvm_host_triple = "x86_64-unknown-linux-gnu"
+  } else if (host_os == "mac") {
+llvm_host_triple = "x86_64-apple-darwin"
+  } else if (host_os == "win") {
+llvm_host_triple = "x86_64-pc-windows"
+  }
+} else {
+  assert(false, "unimplemented host_cpu " + host_cpu)
 }
 
 declare_args() {
Index: llvm/utils/gn/secondary/clang/test/clang_lit_site_cfg_files.gni
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/test/clang_lit_site_cfg_files.gni
@@ -0,0 +1,2 @@
+clang_lit_site_cfg_file = "$root_gen_dir/clang/test/lit.site.cfg.py"
+clang_lit_unit_site_cfg_file = "$root_gen_dir/clang/test/Unit/lit.site.cfg.py"
Index: llvm/utils/gn/secondary/clang/test/BUILD.gn
===
--- /dev/null
+++ llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -0,0 +1,195 @@
+import("//clang/lib/ARCMigrate/enable.gni")
+import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+import("//llvm/lib/Target/targets.gni")
+import("//llvm/triples.gni")
+import("//llvm/utils/gn/build/libs/zlib/enable.gni")
+import("clang_lit_site_cfg_files.gni")
+
+template("write_lit_config") {
+  action(target_name) {
+script = "//llvm/utils/gn/build/write_cmake_config.py"
+
+sources = [
+  invoker.input,
+]
+outputs = [
+  invoker.output,
+]
+args = [
+  "-o",
+  rebase_path(outputs[0], root_out_dir),
+  rebase_path(sources[0], root_out_dir),
+
+  "LIT_SITE_CFG_IN_HEADER=## Autogenerated from ${sources[0]}, do not edit",
+  "CLANG_BINARY_DIR=" +
+  rebase_path(get_label_info("//clang", "target_out_dir")),
+  "CLANG_SOURCE_DIR=" + rebase_path("//clang"),
+  "ENABLE_SHARED=0",
+  "LLVM_BINARY_DIR=" +
+  rebase_path(get_label_info("//llvm", "target_out_dir")),
+  "LLVM_LIBS_DIR=",  # needed only for shared builds
+  "LLVM_SOURCE_DIR=" + rebase_path("//llvm"),
+  "LLVM_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+  "TARGET_TRIPLE=$llvm_target_triple",
+]
+if (host_os == "win") {
+  # See comment for Windows solink in llvm/utils/gn/build/toolchain/BUILD.gn
+  args += [ "SHLIBDIR=" + rebase_path("$root_out_dir/bin") ]
+} else {
+  args += [ "SHLIBDIR=" + rebase_path("$root_out_dir/lib") ]
+}
+args += invoker.extra_args
+  }
+}
+
+write_lit_config("lit_site_cfg") {
+  # Fully-qualified instead of relative for LIT_SITE_CFG_IN_HEADER.
+  input = "//clang/test/lit.site.cfg.py.in"
+  output = clang_lit_site_cfg_file
+
+  extra_args = [
+"CLANG_ANALYZER_WITH_Z3=",  # Must be empty, not 0.
+"CLANG_BUILD_EXAMPLES=0",
+"CLANG_DEFAULT_CXX_STDLIB=",  # Empty string means "default value" here.
+"CLANG_TOOLS_DIR=" + rebase_path("$root_out_dir/bin"),
+
+# This is only used if LLVM_USE_SANITIZER i

[PATCH] D56095: [gn build] Add check-clang target and make it work

2018-12-27 Thread Nico Weber via Phabricator via cfe-commits
thakis marked an inline comment as done.
thakis added inline comments.



Comment at: llvm/utils/gn/secondary/llvm/triples.gni:10
+} else {
+  assert(false, "missing host_cpu " + host_cpu)
 }

phosek wrote:
> I don't think `host_cpu` would ever be missing since it's detected by GN 
> (unless it's a new architecture that GN doesn't recognize), should this 
> rather be `unsupported host_cpu` or something along those lines?
"missing" as in "this is missing code here". "unsupported" doesn't seem quite 
right since the whole GN build is unsupported :-) And if someone needs a new 
host_cpu, they can just send a patch. `"not-yet-implemented host_cpu " + 
host_cpu`? I don't think the exact error string is super important though.


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

https://reviews.llvm.org/D56095



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


[PATCH] D47817: [compiler-rt] [sanitizer_common] Remove support for tirpc/rpc/xdr.h

2018-12-27 Thread Michał Górny via Phabricator via cfe-commits
mgorny updated this revision to Diff 179556.
mgorny retitled this revision from "[compiler-rt] [sanitizer_common] Fix using 
libtirpc on Linux" to "[compiler-rt] [sanitizer_common] Remove support for 
tirpc/rpc/xdr.h".
mgorny edited the summary of this revision.
mgorny added reviewers: krytarowski, vitalybuka.
mgorny added a comment.

Updated to remove tirpc support completely instead, as suggested by 
@krytarowski. Now only built-in glibc implementation is intercepted, and the 
external tirpc library is left for being built with `-fsanitize`.


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

https://reviews.llvm.org/D47817

Files:
  lib/sanitizer_common/CMakeLists.txt
  lib/sanitizer_common/sanitizer_platform.h
  lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
  lib/sanitizer_common/sanitizer_platform_limits_posix.cc


Index: lib/sanitizer_common/sanitizer_platform_limits_posix.cc
===
--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -114,8 +114,6 @@
 #include 
 #if HAVE_RPC_XDR_H
 # include 
-#elif HAVE_TIRPC_RPC_XDR_H
-# include 
 #endif
 #include 
 #include 
@@ -1210,7 +1208,7 @@
 CHECK_SIZE_AND_OFFSET(group, gr_gid);
 CHECK_SIZE_AND_OFFSET(group, gr_mem);
 
-#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H
+#if HAVE_RPC_XDR_H
 CHECK_TYPE_SIZE(XDR);
 CHECK_SIZE_AND_OFFSET(XDR, x_op);
 CHECK_SIZE_AND_OFFSET(XDR, x_ops);
Index: lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
===
--- lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
@@ -500,7 +500,7 @@
 CHECK_SIZE_AND_OFFSET(group, gr_gid);
 CHECK_SIZE_AND_OFFSET(group, gr_mem);
 
-#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H
+#if HAVE_RPC_XDR_H
 CHECK_TYPE_SIZE(XDR);
 CHECK_SIZE_AND_OFFSET(XDR, x_op);
 CHECK_SIZE_AND_OFFSET(XDR, x_ops);
Index: lib/sanitizer_common/sanitizer_platform.h
===
--- lib/sanitizer_common/sanitizer_platform.h
+++ lib/sanitizer_common/sanitizer_platform.h
@@ -275,12 +275,6 @@
 # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 12)
 #endif
 
-// Assume obsolete RPC headers are available by default
-#if !defined(HAVE_RPC_XDR_H) && !defined(HAVE_TIRPC_RPC_XDR_H)
-# define HAVE_RPC_XDR_H (SANITIZER_LINUX && !SANITIZER_ANDROID)
-# define HAVE_TIRPC_RPC_XDR_H 0
-#endif
-
 /// \macro MSC_PREREQ
 /// \brief Is the compiler MSVC of at least the specified version?
 /// The common \param version values to check for are:
Index: lib/sanitizer_common/CMakeLists.txt
===
--- lib/sanitizer_common/CMakeLists.txt
+++ lib/sanitizer_common/CMakeLists.txt
@@ -195,7 +195,6 @@
 
 include(CheckIncludeFile)
 append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H 
SANITIZER_COMMON_DEFINITIONS)
-append_have_file_definition(tirpc/rpc/xdr.h HAVE_TIRPC_RPC_XDR_H 
SANITIZER_COMMON_DEFINITIONS)
 
 set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
 append_rtti_flag(OFF SANITIZER_CFLAGS)


Index: lib/sanitizer_common/sanitizer_platform_limits_posix.cc
===
--- lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -114,8 +114,6 @@
 #include 
 #if HAVE_RPC_XDR_H
 # include 
-#elif HAVE_TIRPC_RPC_XDR_H
-# include 
 #endif
 #include 
 #include 
@@ -1210,7 +1208,7 @@
 CHECK_SIZE_AND_OFFSET(group, gr_gid);
 CHECK_SIZE_AND_OFFSET(group, gr_mem);
 
-#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H
+#if HAVE_RPC_XDR_H
 CHECK_TYPE_SIZE(XDR);
 CHECK_SIZE_AND_OFFSET(XDR, x_op);
 CHECK_SIZE_AND_OFFSET(XDR, x_ops);
Index: lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
===
--- lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
+++ lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
@@ -500,7 +500,7 @@
 CHECK_SIZE_AND_OFFSET(group, gr_gid);
 CHECK_SIZE_AND_OFFSET(group, gr_mem);
 
-#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H
+#if HAVE_RPC_XDR_H
 CHECK_TYPE_SIZE(XDR);
 CHECK_SIZE_AND_OFFSET(XDR, x_op);
 CHECK_SIZE_AND_OFFSET(XDR, x_ops);
Index: lib/sanitizer_common/sanitizer_platform.h
===
--- lib/sanitizer_common/sanitizer_platform.h
+++ lib/sanitizer_common/sanitizer_platform.h
@@ -275,12 +275,6 @@
 # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 12)
 #endif
 
-// Assume obsolete RPC headers are available by default
-#if !defined(HAVE_RPC_XDR_H) && !defined(HAVE_TIRPC_RPC_XDR_H)
-# define HAVE_RPC_XDR_H (SANITIZER_LINUX && !SANITIZER_ANDROID)
-# define HAVE_TIRPC_RPC_XDR_H 0
-#endif
-
 /// \macro MSC_PREREQ
 /// \brief Is the compiler MSVC of at least the specified ve

[PATCH] D33499: [PPC] PPC32/Darwin ABI info

2018-12-27 Thread Ken Cunningham via Phabricator via cfe-commits
ken-cunningham-webuse added a comment.
Herald added subscribers: llvm-commits, jsji.

@iains - I have interest in resolving this issue, and also a couple of other 
lingering bugs in the PPC32Darwin ABI realm. If you have your WIP available 
anywhere, I'd be happy to have a go at bringing it up to current.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D33499



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


Re: r350092 - [objc-gnustep] Fix a copy-and-paste error.

2018-12-27 Thread Roman Lebedev via cfe-commits
test?

On Thu, Dec 27, 2018 at 5:47 PM David Chisnall via cfe-commits
 wrote:
>
> Author: theraven
> Date: Thu Dec 27 06:44:36 2018
> New Revision: 350092
>
> URL: http://llvm.org/viewvc/llvm-project?rev=350092&view=rev
> Log:
> [objc-gnustep] Fix a copy-and-paste error.
>
> We were emitting the null class symbol in the wrong section, which meant
> that programs that contained no Objective-C classes would fail to link.
>
> Modified:
> cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=350092&r1=350091&r2=350092&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Thu Dec 27 06:44:36 2018
> @@ -1547,7 +1547,7 @@ class CGObjCGNUstep2 : public CGObjCGNUs
>  sectionName());
>if (!EmittedClass) {
>  createNullGlobal(".objc_null_cls_init_ref", NULLPtr,
> -sectionName());
> +sectionName());
>  createNullGlobal(".objc_null_class_ref", { NULLPtr, NULLPtr },
>  sectionName());
>}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r350092 - [objc-gnustep] Fix a copy-and-paste error.

2018-12-27 Thread David Chisnall via cfe-commits
Author: theraven
Date: Thu Dec 27 06:44:36 2018
New Revision: 350092

URL: http://llvm.org/viewvc/llvm-project?rev=350092&view=rev
Log:
[objc-gnustep] Fix a copy-and-paste error.

We were emitting the null class symbol in the wrong section, which meant
that programs that contained no Objective-C classes would fail to link.

Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=350092&r1=350091&r2=350092&view=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Thu Dec 27 06:44:36 2018
@@ -1547,7 +1547,7 @@ class CGObjCGNUstep2 : public CGObjCGNUs
 sectionName());
   if (!EmittedClass) {
 createNullGlobal(".objc_null_cls_init_ref", NULLPtr,
-sectionName());
+sectionName());
 createNullGlobal(".objc_null_class_ref", { NULLPtr, NULLPtr },
 sectionName());
   }


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


[PATCH] D21856: [Driver][OpenMP] Add support to create jobs for bundling actions.

2018-12-27 Thread Samuel Antao via Phabricator via cfe-commits
sfantao added a comment.

In D21856#1338687 , @thakis wrote:

> Sorry about the years-later question, but what's the motivation for shelling 
> out to an external command here? In general, LLVM tries to use a 
> library-based approach, and LLVM went e.g. through great lengths do use an 
> integrated assembler so clang doesn't have to shell out to one. Concretely, 
> why isn't there a clang/lib/OffloadBundle library that clang and 
> clang-offload-bundler both use? Does the bundling have to happen 
> out-of-process? And if so, why isn't the process something like `clang 
> -cc1bundle` instead of a separate executable? It seems weird to make clang 
> depend on another executable next to it.
>
> I apologize for the clueless question.


@thakis, I don't think there is anything preventing the bundler from being 
driven by clang and implemented in a library. The discussions about the bundler 
were mostly around the bundling formats - so where it should be implemented was 
not as thoroughly discussed as the the formats we ended up adopting. 
Notwithstanding, there were a few reasons that motivated the current design:

- The bundler should have a driver: users/developers should be able to easily 
pack/unpack the pieces referring to different devices. It could be a `clang 
-cc1bundle` though.
- Offloading with many targets and different host/target combinations would 
require a myriad of formats that need to be used together, so they were some 
informal discussions where people seemed to prefer to separate this complexity 
from clang itself. The bundler would need some dependencies to handle object 
files that were not needed by clang (at least at the time).
- The main use of the bundler is the bundling/unbundling of object files which 
were produced by third party tools (e.g. NVIDIA tools), so there was not a 
clear advantage in integrating the bundler as a library, as one needs to spawn 
a separate process to create its dependences anyway.




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

https://reviews.llvm.org/D21856



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


[PATCH] D54539: [CodeGen] Replace '@' characters in block descriptors' symbol names with '\1' on ELF targets.

2018-12-27 Thread David Chisnall via Phabricator via cfe-commits
theraven added a comment.

Please can we either merge this or revert the original change that introduced 
the bug that this is fixing?  It's now been 6 months since blocks generated 
invalid ELF symbols.


Repository:
  rC Clang

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

https://reviews.llvm.org/D54539



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