Commit 2fcc20f4 authored by Daniel Cheng's avatar Daniel Cheng

Use the Clang plugin on Windows.

BUG=467287
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/1082503002

Cr-Commit-Position: refs/heads/master@{#325465}
parent afc53166
...@@ -2148,20 +2148,31 @@ ...@@ -2148,20 +2148,31 @@
'grit_defines': ['-D', 'enable_service_discovery'], 'grit_defines': ['-D', 'enable_service_discovery'],
'enable_service_discovery%': 1 'enable_service_discovery%': 1
}], }],
['clang_use_chrome_plugins==1 and OS!="win"', { ['clang_use_chrome_plugins==1', {
'variables': { 'variables': {
'conditions': [ 'conditions': [
['OS=="mac" or OS=="ios"', { ['OS!="win"', {
'clang_lib_path%': '<!(cd <(DEPTH) && pwd -P)/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib', 'variables': {
}, { # OS != "mac" or OS != "ios" 'conditions': [
'clang_lib_path%': '<!(cd <(DEPTH) && pwd -P)/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so', ['OS=="mac" or OS=="ios"', {
}], 'clang_lib_path%': '<!(cd <(DEPTH) && pwd -P)/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib',
}, { # OS != "mac" or OS != "ios"
'clang_lib_path%': '<!(cd <(DEPTH) && pwd -P)/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so',
}],
],
},
'clang_dynlib_flags%': '-Xclang -load -Xclang <(clang_lib_path) ',
}, { # OS == "win"
# On Windows, the plugin is built directly into clang, so there's
# no need to load it dynamically.
'clang_dynlib_flags%': '',
}]
], ],
}, },
# If you change these, also change build/config/clang/BUILD.gn. # If you change these, also change build/config/clang/BUILD.gn.
'clang_chrome_plugins_flags%': 'clang_chrome_plugins_flags%':
'-Xclang -load -Xclang <(clang_lib_path)' '<(clang_dynlib_flags)'
' -Xclang -add-plugin -Xclang find-bad-constructs', '-Xclang -add-plugin -Xclang find-bad-constructs',
}], }],
['asan==1 or msan==1 or lsan==1 or tsan==1', { ['asan==1 or msan==1 or lsan==1 or tsan==1', {
'clang%': 1, 'clang%': 1,
...@@ -2214,9 +2225,9 @@ ...@@ -2214,9 +2225,9 @@
}], }],
['OS=="win"', { ['OS=="win"', {
# The Clang plugins don't currently work on Windows. # The Blink GC plugin doesn't currently work on Windows.
# TODO(hans): One day, this will work. (crbug.com/82385) # TODO(hans): One day, this will work. (crbug.com/82385)
'clang_use_chrome_plugins%': 0, 'blink_gc_plugin%': 0,
}], }],
# On valgrind bots, override the optimizer settings so we don't inline too # On valgrind bots, override the optimizer settings so we don't inline too
...@@ -5612,6 +5623,13 @@ ...@@ -5612,6 +5623,13 @@
], ],
}, },
}], }],
['clang==1 and clang_use_chrome_plugins==1', {
'VCCLCompilerTool': {
'AdditionalOptions': [
'<@(clang_chrome_plugins_flags)',
],
},
}],
], ],
}, },
}, },
......
...@@ -6,20 +6,29 @@ import("clang.gni") ...@@ -6,20 +6,29 @@ import("clang.gni")
config("find_bad_constructs") { config("find_bad_constructs") {
if (clang_use_chrome_plugins) { if (clang_use_chrome_plugins) {
cflags = [ cflags = []
"-Xclang",
"-load", # On Windows, the plugin is built directly into clang, so there's
"-Xclang", # no need to load it dynamically.
]
if (is_mac || is_ios) { if (is_mac || is_ios) {
cflags += [ rebase_path( cflags += [
"//third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib", "-Xclang",
root_build_dir) ] "-load",
"-Xclang",
rebase_path(
"//third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib",
root_build_dir),
]
} else if (is_linux) { } else if (is_linux) {
cflags += [ rebase_path( cflags += [
"//third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so", "-Xclang",
root_build_dir) ] "-load",
"-Xclang",
rebase_path(
"//third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so",
root_build_dir),
]
} }
cflags += [ cflags += [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment