[PATCH] D16819: Remove llvm::(cast|isa) from lib/CodeGen/Address.h to fix build with gcc-4.8.1
sugak created this revision. sugak added reviewers: rsmith, rjmccall. sugak added subscribers: hans, cfe-commits. gcc-4.8.1 fails to build clang because of a regression in that version of gcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58022). See details about the generated error in https://llvm.org/bugs/show_bug.cgi?id=26362. To work around the build error, this diff moves definitions `cast(clang::CodeGen::Address)` and `isa(clang::CodeGen::Address)` from llvm to clang namespace. No build errors are introduced with this change. I've tested this with gcc-4.8.1 and gcc-4.9.0 both on master and release_38. http://reviews.llvm.org/D16819 Files: lib/CodeGen/Address.h Index: lib/CodeGen/Address.h === --- lib/CodeGen/Address.h +++ lib/CodeGen/Address.h @@ -104,23 +104,15 @@ }; } -} -namespace llvm { - // Present a minimal LLVM-like casting interface. - template inline U cast(clang::CodeGen::Address addr) { -return U::castImpl(addr); - } - template inline bool isa(clang::CodeGen::Address addr) { -return U::isaImpl(addr); - } +// Present a minimal LLVM-like casting interface. +template inline U cast(CodeGen::Address addr) { + return U::castImpl(addr); +} +template inline bool isa(CodeGen::Address addr) { + return U::isaImpl(addr); } -namespace clang { - // Make our custom isa and cast available in namespace clang, to mirror - // what we do for LLVM's versions in Basic/LLVM.h. - using llvm::isa; - using llvm::cast; } #endif Index: lib/CodeGen/Address.h === --- lib/CodeGen/Address.h +++ lib/CodeGen/Address.h @@ -104,23 +104,15 @@ }; } -} -namespace llvm { - // Present a minimal LLVM-like casting interface. - template inline U cast(clang::CodeGen::Address addr) { -return U::castImpl(addr); - } - template inline bool isa(clang::CodeGen::Address addr) { -return U::isaImpl(addr); - } +// Present a minimal LLVM-like casting interface. +template inline U cast(CodeGen::Address addr) { + return U::castImpl(addr); +} +template inline bool isa(CodeGen::Address addr) { + return U::isaImpl(addr); } -namespace clang { - // Make our custom isa and cast available in namespace clang, to mirror - // what we do for LLVM's versions in Basic/LLVM.h. - using llvm::isa; - using llvm::cast; } #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D16819: Remove llvm::(cast|isa) from lib/CodeGen/Address.h to fix build with gcc-4.8.1
sugak added a comment. @rsmith: yes, I need someone to commit this. http://reviews.llvm.org/D16819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D17049: [CMake] don't build libLTO when LLVM_ENABLE_PIC is OFF
sugak created this revision. sugak added a reviewer: beanz. sugak added subscribers: hans, cfe-commits. Herald added a subscriber: joker.eph. When cmake is run with `-DLLVM_ENABLE_PIC=OFF`, build fails while linking shared library libLTO.so, because its dependencies are built with -fno-PIC. More details here: https://llvm.org/bugs/show_bug.cgi?id=26484. This diff reverts r252652 (git 9fd4377ddb83aee3c049dc8757e7771edbb8ee71), which removed check `NOT LLVM_ENABLE_PIC` before enabling build for libLTO.so. I've verified that when cmake is run with `-DLLVM_ENABLE_PIC=ON`, libLTO.so is still generated, as well as when this option is not specified and the default value (ON) is used. Tested both on master and release_38. http://reviews.llvm.org/D17049 Files: tools/CMakeLists.txt Index: tools/CMakeLists.txt === --- tools/CMakeLists.txt +++ tools/CMakeLists.txt @@ -25,7 +25,7 @@ set(LLVM_TOOL_LLVM_JITLISTENER_BUILD Off) endif() -if(CYGWIN) +if(CYGWIN OR NOT LLVM_ENABLE_PIC) set(LLVM_TOOL_LTO_BUILD Off) set(LLVM_TOOL_LLVM_LTO_BUILD Off) endif() Index: tools/CMakeLists.txt === --- tools/CMakeLists.txt +++ tools/CMakeLists.txt @@ -25,7 +25,7 @@ set(LLVM_TOOL_LLVM_JITLISTENER_BUILD Off) endif() -if(CYGWIN) +if(CYGWIN OR NOT LLVM_ENABLE_PIC) set(LLVM_TOOL_LTO_BUILD Off) set(LLVM_TOOL_LLVM_LTO_BUILD Off) endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D21050: [clang-tidy] correct clang-tidy-diff.py help message
sugak created this revision. sugak added reviewers: klimek, alexfh. sugak added a subscriber: cfe-commits. Looks like the original code was copied from clang-format-diff.py. Update help message to make it clang-tidy specific. http://reviews.llvm.org/D21050 Files: clang-tidy/tool/clang-tidy-diff.py Index: clang-tidy/tool/clang-tidy-diff.py === --- clang-tidy/tool/clang-tidy-diff.py +++ clang-tidy/tool/clang-tidy-diff.py @@ -33,20 +33,20 @@ def main(): parser = argparse.ArgumentParser(description= - 'Reformat changed lines in diff. Without -i ' - 'option just output the diff that would be ' - 'introduced.') + 'Run clang-tidy against changed files, and ' + 'output diagnostics only for modified ' + 'lines.') parser.add_argument('-clang-tidy-binary', metavar='PATH', default='clang-tidy', help='path to clang-tidy binary') parser.add_argument('-p', metavar='NUM', default=0, help='strip the smallest prefix containing P slashes') parser.add_argument('-regex', metavar='PATTERN', default=None, - help='custom pattern selecting file paths to reformat ' + help='custom pattern selecting file paths to check ' '(case sensitive, overrides -iregex)') parser.add_argument('-iregex', metavar='PATTERN', default= r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)', - help='custom pattern selecting file paths to reformat ' + help='custom pattern selecting file paths to check ' '(case insensitive, overridden by -regex)') parser.add_argument('-fix', action='store_true', default=False, Index: clang-tidy/tool/clang-tidy-diff.py === --- clang-tidy/tool/clang-tidy-diff.py +++ clang-tidy/tool/clang-tidy-diff.py @@ -33,20 +33,20 @@ def main(): parser = argparse.ArgumentParser(description= - 'Reformat changed lines in diff. Without -i ' - 'option just output the diff that would be ' - 'introduced.') + 'Run clang-tidy against changed files, and ' + 'output diagnostics only for modified ' + 'lines.') parser.add_argument('-clang-tidy-binary', metavar='PATH', default='clang-tidy', help='path to clang-tidy binary') parser.add_argument('-p', metavar='NUM', default=0, help='strip the smallest prefix containing P slashes') parser.add_argument('-regex', metavar='PATTERN', default=None, - help='custom pattern selecting file paths to reformat ' + help='custom pattern selecting file paths to check ' '(case sensitive, overrides -iregex)') parser.add_argument('-iregex', metavar='PATTERN', default= r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)', - help='custom pattern selecting file paths to reformat ' + help='custom pattern selecting file paths to check ' '(case insensitive, overridden by -regex)') parser.add_argument('-fix', action='store_true', default=False, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21050: [clang-tidy] correct clang-tidy-diff.py help message
sugak added inline comments. Comment at: clang-tidy/tool/clang-tidy-diff.py:42 @@ -41,3 +41,3 @@ help='path to clang-tidy binary') parser.add_argument('-p', metavar='NUM', default=0, help='strip the smallest prefix containing P slashes') Eugene.Zelenko wrote: > Shouldn't -p be used to specify compile database as in run-clang-tidy.py? From the test plan it looks like this script doesn't support compilation database input: ```lang=bash git diff -U0 HEAD^ | clang-tidy-diff.py -checks=-*,misc-use-override -p1 -- -std=gnu++14 ``` It is similar to `patch`-like tools that process unified diff input -- uses `-p` to adjust file path. I can fix it in a separate diff, just need a better name for the current function of `-p`. http://reviews.llvm.org/D21050 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21050: [clang-tidy] correct clang-tidy-diff.py help message
sugak added a comment. Thank you for the review! I need someone to commit this for me :) http://reviews.llvm.org/D21050 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits