r293518 - [ASTMatchers] Sprinkle some constexpr on the global matcher constructors.

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 3 15:10:03 PST 2017


Note that this also failed on Linux:
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/2728

This looks like a modules compiler bug, as opposed to a problem in the commit itself.  Alex, can you file a PR for this?

> On 2017-Feb-01, at 07:35, Alex L via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> 
> I've narrowed the problem down to the difference in the linkage type for "clang::ast_matchers::recordDecl" between the module and non-module build:
> 
> Module:
> @_ZN5clang12ast_matchersL10recordDeclE = external global %"class.clang::ast_matchers::internal::VariadicDynCastAllOfMatcher.847", align 1
> 
> Non-module:
> @_ZN5clang12ast_matchersL10recordDeclE = internal constant %"class.clang::ast_matchers::internal::VariadicDynCastAllOfMatcher.916" undef, align 1, !dbg !7
> 
> On 1 February 2017 at 11:03, Alex L <arphaman at gmail.com> wrote:
> Hi Benjamin,
> 
> This commit has caused a linking in our stage 2 modules buildbot at http://lab.llvm.org:8080/green/job/clang-stage2-cmake-modulesRDA/. Specifically, after this commit 'clang-reorder-fields' gets the following linking error:
> 
> FAILED: bin/clang-reorder-fields 
> : && /Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-modulesRDA at 2/host-compiler/bin/clang++   -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c++11 -fmodules -fmodules-cache-path=/Users/buildslave/jenkins/sharedspace/clang-stage2-cmake-modulesRDA at 2/clang-build/module.cache -fcxx-modules -gmodules -fcolor-diagnostics -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O2 -g -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-dead_strip tools/clang/tools/extra/clang-reorder-fields/tool/CMakeFiles/clang-reorder-fields.dir/ClangReorderFields.cpp.o  -o bin/clang-reorder-fields  lib/libLLVMSupport.a lib/libclangBasic.a lib/libclangFrontend.a lib/libclangReorderFields.a lib/libclangRewrite.a lib/libclangTooling.a lib/libclangToolingCore.a lib/libclangIndex.a lib/libclangFrontend.a lib/libclangParse.a lib/libLLVMMCParser.a lib/libclangSerialization.a lib/libclangSema.a lib/libclangEdit.a lib/libclangAnalysis.a lib/libLLVMBitReader.a lib/libLLVMProfileData.a lib/libclangDriver.a lib/libLLVMOption.a lib/libclangASTMatchers.a lib/libclangFormat.a lib/libclangToolingCore.a lib/libclangRewrite.a lib/libclangAST.a lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMMC.a lib/libLLVMSupport.a -lcurses -lz -lm lib/libLLVMDemangle.a -Wl,-rpath, at loader_path/../lib && :
> Undefined symbols for architecture x86_64:
>   "clang::ast_matchers::recordDecl", referenced from:
>       clang::reorder_fields::(anonymous namespace)::ReorderingConsumer::HandleTranslationUnit(clang::ASTContext&) in libclangReorderFields.a(ReorderFieldsAction.cpp.o)
> ld: symbol(s) not found for architecture x86_64
> 
> This might be a bug/regression in clang and modules since in my opinion the link should succeed. I've reverted your commit in r293759 while we are investigating.
> 
> Thanks,
> Alex
> 
> 
> On 30 January 2017 at 18:20, Benjamin Kramer via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> Author: d0k
> Date: Mon Jan 30 12:20:00 2017
> New Revision: 293518
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=293518&view=rev
> Log:
> [ASTMatchers] Sprinkle some constexpr on the global matcher constructors.
> 
> This dramatically reduces the size of the global constructors we emit
> for those variables in debug mode.
> 
> Modified:
>     cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> 
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=293518&r1=293517&r2=293518&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Mon Jan 30 12:20:00 2017
> @@ -1459,7 +1459,7 @@ class VariadicDynCastAllOfMatcher
>      : public VariadicFunction<BindableMatcher<SourceT>, Matcher<TargetT>,
>                                makeDynCastAllOfComposite<SourceT, TargetT>> {
>  public:
> -  VariadicDynCastAllOfMatcher() {}
> +  constexpr VariadicDynCastAllOfMatcher() {}
>  };
> 
>  /// \brief A \c VariadicAllOfMatcher<T> object is a variadic functor that takes
> @@ -1477,7 +1477,7 @@ class VariadicAllOfMatcher
>      : public VariadicFunction<BindableMatcher<T>, Matcher<T>,
>                                makeAllOfComposite<T>> {
>  public:
> -  VariadicAllOfMatcher() {}
> +  constexpr VariadicAllOfMatcher() {}
>  };
> 
>  /// \brief Matches nodes of type \c TLoc for which the inner
> @@ -1598,7 +1598,7 @@ public:
> 
>    struct Func
>        : public VariadicFunction<Self, Matcher<InnerTBase>, &Self::create> {
> -    Func() {}
> +    constexpr Func() {}
>    };
> 
>  private:
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list