[clang] 4e4ab8e - [clang] Limit scope of CLANG_VENDOR definition

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 09:05:06 PST 2020


Author: Shoaib Meenai
Date: 2020-11-02T09:04:43-08:00
New Revision: 4e4ab8e0152b42baef5e5a1e2484d865e1a57e90

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

LOG: [clang] Limit scope of CLANG_VENDOR definition

It's only used by Version.cpp, so limit the definition to just that one
file instead of making all of Clang recompile if you change CLANG_VENDOR.

Reviewed By: phosek

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

Added: 
    

Modified: 
    clang/CMakeLists.txt
    clang/lib/Basic/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index a2b99e2e37e9..8c539e80946d 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -332,10 +332,6 @@ set(CLANG_SYSTEMZ_DEFAULT_ARCH "z10" CACHE STRING "SystemZ Default Arch")
 set(CLANG_VENDOR ${PACKAGE_VENDOR} CACHE STRING
   "Vendor-specific text for showing with version information.")
 
-if( CLANG_VENDOR )
-  add_definitions( -DCLANG_VENDOR="${CLANG_VENDOR} " )
-endif()
-
 set(CLANG_REPOSITORY_STRING "" CACHE STRING
   "Vendor-specific text for showing the repository the source is taken from.")
 

diff  --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index d259b951f2c2..0ca4148801fc 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -33,6 +33,11 @@ set_source_files_properties("${version_inc}"
   PROPERTIES GENERATED TRUE
              HEADER_FILE_ONLY TRUE)
 
+if(CLANG_VENDOR)
+  set_source_files_properties(Version.cpp
+    PROPERTIES COMPILE_DEFINITIONS "CLANG_VENDOR=\"${CLANG_VENDOR} \"")
+endif()
+
 add_clang_library(clangBasic
   Attributes.cpp
   Builtins.cpp


        


More information about the cfe-commits mailing list