[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread kchoi via Phabricator via cfe-commits
choikwa added a comment.

In https://reviews.llvm.org/D37624#885290, @hfinkel wrote:

> In https://reviews.llvm.org/D37624#885288, @choikwa wrote:
>
> > - add comment to CPP test to explain usage
>
>
> Thanks. Please also add some tests showing matching overloaded functions, 
> functions with template parameters, etc.
>
> Do we need to strip whitespace before trying to match the demangled names?


Some cursory testing with g++ shows that only the 'test5' of 'test5(float, int, 
int*)' is matched. 'test5(' or 'test5 (' is not matched. It seems weird that 
arguments are not matched.




Comment at: test/CodeGenCXX/instrument-functions.cpp:8
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions 
-finstrument-functions-exclude-function-list=test3 | FileCheck %s 
--check-prefix=NOFUNC
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions 
-finstrument-functions-exclude-function-list=Z5test3 | FileCheck %s 
--check-prefix=NOFUNC2
+

hfinkel wrote:
> I'm a bit confused about this test. Are you trying to match against the 
> mangled names, or the demangled names, or both?
It's matching demangled names, so Z5test3 would not match and insert 
instrumentation calls to test3(int). Since this wasn't clear, I will add 
comment in the test.


https://reviews.llvm.org/D37624



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


[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread David Majnemer via Phabricator via cfe-commits
majnemer added inline comments.



Comment at: lib/CodeGen/CodeGenFunction.cpp:455
+for (const auto  : PathSearch) {
+  if(FunctionDeclPath.find(FileMatch) != std::string::npos) {
+return false;

Space after if.



Comment at: lib/CodeGen/CodeGenFunction.cpp:473
+  for (const auto  : FunctionSearch) {
+if(FunctionName.find(FuncMatch) != std::string::npos) {
+  return false;

Ditto.


https://reviews.llvm.org/D37624



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


[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread kchoi via Phabricator via cfe-commits
choikwa updated this revision to Diff 117269.
choikwa added a comment.

- add more CPP tests: func overload, template special


https://reviews.llvm.org/D37624

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/instrument-functions.c
  test/CodeGenCXX/instrument-functions.cpp

Index: test/CodeGenCXX/instrument-functions.cpp
===
--- test/CodeGenCXX/instrument-functions.cpp
+++ test/CodeGenCXX/instrument-functions.cpp
@@ -1,10 +1,32 @@
 // RUN: %clang_cc1 -S -emit-llvm -triple %itanium_abi_triple -o - %s -finstrument-functions | FileCheck %s
 
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -fno-instrument-functions | FileCheck %s --check-prefix=NOINSTR
+
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-file-list=instrument | FileCheck %s --check-prefix=NOFILE
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=NOFUNC
+
+// Below would see if mangled name partially matches. exclude-function-list matches demangled names, thus we expect to see instrument calls in test3.
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=Z5test3 | FileCheck %s --check-prefix=NOFUNC2
+
+
 // CHECK: @_Z5test1i
+// NOINSTR: @_Z5test1i
+// NOFILE: @_Z5test1i
+// NOFUNC: @_Z5test1i
 int test1(int x) {
 // CHECK: __cyg_profile_func_enter
 // CHECK: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC: __cyg_profile_func_enter
+// NOFUNC: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
 
@@ -17,6 +39,82 @@
   return x;
 }
 
+// CHECK: @_Z5test3i
+// NOINSTR: @_Z5test3i
+// NOFILE: @_Z5test3i
+// NOFUNC: @_Z5test3i
+// NOFUNC2: @_Z5test3i
+int test3(int x) {
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
+// CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
+// NOFUNC2: __cyg_profile_func_enter
+// NOFUNC2: __cyg_profile_func_exit
+// NOFUNC2: ret
+  return x;
+}
+
+// Check function overload
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=OVERLOAD
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=Z5test3v | FileCheck %s --check-prefix=OVERLOAD1
+
+// OVERLOAD: @_Z5test3v
+// OVERLOAD1: @_Z5test3v
+int test3() {
+// OVERLOAD-NOT: __cyg_profile_func_enter
+// OVERLOAD-NOT: __cyg_profile_func_exit
+// OVERLOAD: ret
+// OVERLOAD1: __cyg_profile_func_enter
+// OVERLOAD1: __cyg_profile_func_exit
+// OVERLOAD1: ret
+  return 1;
+}
+
+template 
+T test4(T a) {
+  return a;
+}
+
+// Check function with template specialization
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test4 | FileCheck %s --check-prefix=TPL
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=Z5test4Ii | FileCheck %s --check-prefix=TPL1
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=Z5test4Is | FileCheck %s --check-prefix=TPL2
+
+// TPL: @_Z5test4IiET_S0_
+// TPL1: @_Z5test4IiET_S0_
+template<>
+int test4(int a) {
+// TPL-NOT: __cyg_profile_func_enter
+// TPL-NOT: __cyg_profile_func_exit
+// TPL: ret
+// TPL1: __cyg_profile_func_enter
+// TPL1: __cyg_profile_func_exit
+// TPL1: ret
+  return a;
+}
+
+// TPL: @_Z5test4IsET_S0_
+// TPL2: @_Z5test4IsET_S0_
+template<>
+short test4(short a) {
+// TPL-NOT: __cyg_profile_func_enter
+// TPL-NOT: __cyg_profile_func_exit
+// TPL: ret
+// TPL2: __cyg_profile_func_enter
+// TPL2: __cyg_profile_func_exit
+// TPL2: ret
+  return a;
+}
+
 // This test case previously crashed code generation.  It exists solely
 // to test -finstrument-function does not crash codegen for this trivial
 // case.
Index: test/CodeGen/instrument-functions.c
===
--- test/CodeGen/instrument-functions.c
+++ test/CodeGen/instrument-functions.c
@@ -1,18 +1,66 @@
-// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | 

[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D37624#885288, @choikwa wrote:

> - add comment to CPP test to explain usage


Thanks. Please also add some tests showing matching overloaded functions, 
functions with template parameters, etc.

Do we need to strip whitespace before trying to match the demangled names?


https://reviews.llvm.org/D37624



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


[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread kchoi via Phabricator via cfe-commits
choikwa updated this revision to Diff 117268.
choikwa added a comment.

- add comment to CPP test to explain usage


https://reviews.llvm.org/D37624

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/instrument-functions.c
  test/CodeGenCXX/instrument-functions.cpp

Index: test/CodeGenCXX/instrument-functions.cpp
===
--- test/CodeGenCXX/instrument-functions.cpp
+++ test/CodeGenCXX/instrument-functions.cpp
@@ -1,10 +1,32 @@
 // RUN: %clang_cc1 -S -emit-llvm -triple %itanium_abi_triple -o - %s -finstrument-functions | FileCheck %s
 
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -fno-instrument-functions | FileCheck %s --check-prefix=NOINSTR
+
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-file-list=instrument | FileCheck %s --check-prefix=NOFILE
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=NOFUNC
+
+// Below would see if mangled name partially matches. exclude-function-list matches demangled names, thus we expect to see instrument calls in test3.
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=Z5test3 | FileCheck %s --check-prefix=NOFUNC2
+
+
 // CHECK: @_Z5test1i
+// NOINSTR: @_Z5test1i
+// NOFILE: @_Z5test1i
+// NOFUNC: @_Z5test1i
 int test1(int x) {
 // CHECK: __cyg_profile_func_enter
 // CHECK: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC: __cyg_profile_func_enter
+// NOFUNC: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
 
@@ -17,6 +39,30 @@
   return x;
 }
 
+// CHECK: @_Z5test3i
+// NOINSTR: @_Z5test3i
+// NOFILE: @_Z5test3i
+// NOFUNC: @_Z5test3i
+// NOFUNC2: @_Z5test3i
+int test3(int x){
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
+// CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
+// NOFUNC2: __cyg_profile_func_enter
+// NOFUNC2: __cyg_profile_func_exit
+// NOFUNC2: ret
+  return x;
+}
+
 // This test case previously crashed code generation.  It exists solely
 // to test -finstrument-function does not crash codegen for this trivial
 // case.
Index: test/CodeGen/instrument-functions.c
===
--- test/CodeGen/instrument-functions.c
+++ test/CodeGen/instrument-functions.c
@@ -1,18 +1,66 @@
-// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -fno-instrument-functions | FileCheck %s --check-prefix=NOINSTR
+
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-file-list=instrument | FileCheck %s --check-prefix=NOFILE
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=NOFUNC
 
 // CHECK: @test1
+// NOINSTR: @test1
+// NOFILE: @test1
+// NOFUNC: @test1
 int test1(int x) {
-// CHECK: call void @__cyg_profile_func_enter({{.*}}, !dbg
-// CHECK: call void @__cyg_profile_func_exit({{.*}}, !dbg
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC: __cyg_profile_func_enter
+// NOFUNC: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
 
 // CHECK: @test2
+// NOINSTR: @test2
+// NOFILE: @test2
+// NOFUNC: @test2
 int test2(int) __attribute__((no_instrument_function));
 int test2(int x) {
 // CHECK-NOT: __cyg_profile_func_enter
 // CHECK-NOT: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
+  return x;
+}
+
+// CHECK: @test3
+// NOINSTR: @test3
+// NOFILE: @test3
+// NOFUNC: 

[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added inline comments.



Comment at: test/CodeGenCXX/instrument-functions.cpp:8
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions 
-finstrument-functions-exclude-function-list=test3 | FileCheck %s 
--check-prefix=NOFUNC
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions 
-finstrument-functions-exclude-function-list=Z5test3 | FileCheck %s 
--check-prefix=NOFUNC2
+

I'm a bit confused about this test. Are you trying to match against the mangled 
names, or the demangled names, or both?


https://reviews.llvm.org/D37624



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


[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread kchoi via Phabricator via cfe-commits
choikwa updated this revision to Diff 117267.
choikwa added a comment.

- - Address formating feedback, remove redundant inline


https://reviews.llvm.org/D37624

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/instrument-functions.c
  test/CodeGenCXX/instrument-functions.cpp

Index: test/CodeGenCXX/instrument-functions.cpp
===
--- test/CodeGenCXX/instrument-functions.cpp
+++ test/CodeGenCXX/instrument-functions.cpp
@@ -1,10 +1,29 @@
 // RUN: %clang_cc1 -S -emit-llvm -triple %itanium_abi_triple -o - %s -finstrument-functions | FileCheck %s
 
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -fno-instrument-functions | FileCheck %s --check-prefix=NOINSTR
+
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-file-list=instrument | FileCheck %s --check-prefix=NOFILE
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=NOFUNC
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=Z5test3 | FileCheck %s --check-prefix=NOFUNC2
+
 // CHECK: @_Z5test1i
+// NOINSTR: @_Z5test1i
+// NOFILE: @_Z5test1i
+// NOFUNC: @_Z5test1i
 int test1(int x) {
 // CHECK: __cyg_profile_func_enter
 // CHECK: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC: __cyg_profile_func_enter
+// NOFUNC: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
 
@@ -17,6 +36,30 @@
   return x;
 }
 
+// CHECK: @_Z5test3i
+// NOINSTR: @_Z5test3i
+// NOFILE: @_Z5test3i
+// NOFUNC: @_Z5test3i
+// NOFUNC2: @_Z5test3i
+int test3(int x){
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
+// CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
+// NOFUNC2: __cyg_profile_func_enter
+// NOFUNC2: __cyg_profile_func_exit
+// NOFUNC2: ret
+  return x;
+}
+
 // This test case previously crashed code generation.  It exists solely
 // to test -finstrument-function does not crash codegen for this trivial
 // case.
Index: test/CodeGen/instrument-functions.c
===
--- test/CodeGen/instrument-functions.c
+++ test/CodeGen/instrument-functions.c
@@ -1,18 +1,66 @@
-// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -fno-instrument-functions | FileCheck %s --check-prefix=NOINSTR
+
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-file-list=instrument | FileCheck %s --check-prefix=NOFILE
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=NOFUNC
 
 // CHECK: @test1
+// NOINSTR: @test1
+// NOFILE: @test1
+// NOFUNC: @test1
 int test1(int x) {
-// CHECK: call void @__cyg_profile_func_enter({{.*}}, !dbg
-// CHECK: call void @__cyg_profile_func_exit({{.*}}, !dbg
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC: __cyg_profile_func_enter
+// NOFUNC: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
 
 // CHECK: @test2
+// NOINSTR: @test2
+// NOFILE: @test2
+// NOFUNC: @test2
 int test2(int) __attribute__((no_instrument_function));
 int test2(int x) {
 // CHECK-NOT: __cyg_profile_func_enter
 // CHECK-NOT: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
+  return x;
+}
+
+// CHECK: @test3
+// NOINSTR: @test3
+// NOFILE: @test3
+// NOFUNC: @test3
+int test3(int x) {
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
+// CHECK: ret
+// NOINSTR-NOT: 

[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread David Majnemer via Phabricator via cfe-commits
majnemer added inline comments.



Comment at: lib/CodeGen/CodeGenFunction.cpp:463
+
+  // Skip demangling if decl is extern "C"
+  if (ActualFuncDecl && !ActualFuncDecl->isExternC()) {

Is this comment still correct?



Comment at: lib/CodeGen/CodeGenModule.h:503
+  /// Mapping from SourceLocation to PresumedLoc FileName
+  llvm::DenseMap SourceLocToFileNameMap;
+

Pointers lean right.



Comment at: lib/CodeGen/CodeGenModule.h:1212
+  /// Get SourceLoc to FileName map cache
+  inline llvm::DenseMap () {
+return SourceLocToFileNameMap;

inline is redundant here.


https://reviews.llvm.org/D37624



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


[libcxx] r314608 - [test] Allow other implementations to strengthen noexcept on deque's move constructor

2017-09-30 Thread Casey Carter via cfe-commits
Author: caseycarter
Date: Sat Sep 30 16:15:22 2017
New Revision: 314608

URL: http://llvm.org/viewvc/llvm-project?rev=314608=rev
Log:
[test] Allow other implementations to strengthen noexcept on deque's move 
constructor

Modified:

libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp?rev=314608=314607=314608=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/deque/deque.cons/move_noexcept.pass.cpp
 Sat Sep 30 16:15:22 2017
@@ -45,9 +45,9 @@ int main()
 typedef std::deque C;
 static_assert(std::is_nothrow_move_constructible::value, "");
 }
-#endif // _LIBCPP_VERSION
 {
 typedef std::deque C;
 static_assert(!std::is_nothrow_move_constructible::value, "");
 }
+#endif // _LIBCPP_VERSION
 }


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


r314605 - [Analysis] Remove unused makeLvalueToRValue variant.

2017-09-30 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Sep 30 14:49:15 2017
New Revision: 314605

URL: http://llvm.org/viewvc/llvm-project?rev=314605=rev
Log:
[Analysis] Remove unused makeLvalueToRValue variant.

Modified:
cfe/trunk/lib/Analysis/BodyFarm.cpp

Modified: cfe/trunk/lib/Analysis/BodyFarm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BodyFarm.cpp?rev=314605=314604=314605=diff
==
--- cfe/trunk/lib/Analysis/BodyFarm.cpp (original)
+++ cfe/trunk/lib/Analysis/BodyFarm.cpp Sat Sep 30 14:49:15 2017
@@ -78,10 +78,6 @@ public:
   /// Create an implicit cast for lvalue-to-rvaluate conversions.
   ImplicitCastExpr *makeLvalueToRvalue(const Expr *Arg, QualType Ty);
   
-  /// Create an implicit cast for lvalue-to-rvaluate conversions.
-  ImplicitCastExpr *makeLvalueToRvalue(const Expr *Arg,
-   bool GetNonReferenceType = false);
-
   /// Make RValue out of variable declaration, creating a temporary
   /// DeclRefExpr in the process.
   ImplicitCastExpr *
@@ -164,15 +160,6 @@ ImplicitCastExpr *ASTMaker::makeLvalueTo
   return makeImplicitCast(Arg, Ty, CK_LValueToRValue);
 }
 
-ImplicitCastExpr *ASTMaker::makeLvalueToRvalue(const Expr *Arg,
-   bool GetNonReferenceType) {
-
-  QualType Type = Arg->getType();
-  if (GetNonReferenceType)
-Type = Type.getNonReferenceType();
-  return makeImplicitCast(Arg, Type, CK_LValueToRValue);
-}
-
 ImplicitCastExpr *
 ASTMaker::makeLvalueToRvalue(const VarDecl *Arg,
  bool RefersToEnclosingVariableOrCapture,


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


[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list=<arg1, arg2, ...> to match gcc options.

2017-09-30 Thread kchoi via Phabricator via cfe-commits
choikwa updated this revision to Diff 117264.
choikwa added a comment.

Addressing Hal's feedback


https://reviews.llvm.org/D37624

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/instrument-functions.c
  test/CodeGenCXX/instrument-functions.cpp

Index: test/CodeGenCXX/instrument-functions.cpp
===
--- test/CodeGenCXX/instrument-functions.cpp
+++ test/CodeGenCXX/instrument-functions.cpp
@@ -1,10 +1,28 @@
 // RUN: %clang_cc1 -S -emit-llvm -triple %itanium_abi_triple -o - %s -finstrument-functions | FileCheck %s
 
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -fno-instrument-functions | FileCheck %s --check-prefix=NOINSTR
+
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-file-list=instrument | FileCheck %s --check-prefix=NOFILE
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=NOFUNC
+
 // CHECK: @_Z5test1i
+// NOINSTR: @_Z5test1i
+// NOFILE: @_Z5test1i
+// NOFUNC: @_Z5test1i
 int test1(int x) {
 // CHECK: __cyg_profile_func_enter
 // CHECK: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC: __cyg_profile_func_enter
+// NOFUNC: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
 
@@ -17,6 +35,26 @@
   return x;
 }
 
+// CHECK: @_Z5test3i
+// NOINSTR: @_Z5test3i
+// NOFILE: @_Z5test3i
+// NOFUNC: @_Z5test3i
+int test3(int x){
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
+// CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
+  return x;
+}
+
 // This test case previously crashed code generation.  It exists solely
 // to test -finstrument-function does not crash codegen for this trivial
 // case.
Index: test/CodeGen/instrument-functions.c
===
--- test/CodeGen/instrument-functions.c
+++ test/CodeGen/instrument-functions.c
@@ -1,18 +1,66 @@
-// RUN: %clang_cc1 -S -debug-info-kind=standalone -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions | FileCheck %s
+// RUN: %clang -S -emit-llvm -o - %s -fno-instrument-functions | FileCheck %s --check-prefix=NOINSTR
+
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-file-list=instrument | FileCheck %s --check-prefix=NOFILE
+// RUN: %clang -S -emit-llvm -o - %s -finstrument-functions -finstrument-functions-exclude-function-list=test3 | FileCheck %s --check-prefix=NOFUNC
 
 // CHECK: @test1
+// NOINSTR: @test1
+// NOFILE: @test1
+// NOFUNC: @test1
 int test1(int x) {
-// CHECK: call void @__cyg_profile_func_enter({{.*}}, !dbg
-// CHECK: call void @__cyg_profile_func_exit({{.*}}, !dbg
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC: __cyg_profile_func_enter
+// NOFUNC: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
 
 // CHECK: @test2
+// NOINSTR: @test2
+// NOFILE: @test2
+// NOFUNC: @test2
 int test2(int) __attribute__((no_instrument_function));
 int test2(int x) {
 // CHECK-NOT: __cyg_profile_func_enter
 // CHECK-NOT: __cyg_profile_func_exit
 // CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
+  return x;
+}
+
+// CHECK: @test3
+// NOINSTR: @test3
+// NOFILE: @test3
+// NOFUNC: @test3
+int test3(int x) {
+// CHECK: __cyg_profile_func_enter
+// CHECK: __cyg_profile_func_exit
+// CHECK: ret
+// NOINSTR-NOT: __cyg_profile_func_enter
+// NOINSTR-NOT: __cyg_profile_func_exit
+// NOINSTR: ret
+// NOFILE-NOT: __cyg_profile_func_enter
+// NOFILE-NOT: __cyg_profile_func_exit
+// NOFILE: ret
+// NOFUNC-NOT: __cyg_profile_func_enter
+// NOFUNC-NOT: __cyg_profile_func_exit
+// NOFUNC: ret
   return x;
 }
Index: 

[PATCH] D38048: [clangd] Add textDocument/signatureHelp

2017-09-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols added inline comments.



Comment at: clangd/Protocol.h:458
+///
+/// A parameter can have a label and a doc-comment.
+struct ParameterInformation {

@malaperle I copied the sentences from the protocol markdown file over 
[here](https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md),
 but judging from your comment 
[here](https://reviews.llvm.org/D35894#inline-314196) that might a problem. Do 
you suggest to change this or is this okay as-is?


https://reviews.llvm.org/D38048



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


[PATCH] D38048: [clangd] Add textDocument/signatureHelp

2017-09-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols marked 2 inline comments as done.
rwols added a comment.

I see now I have accidentally removed that new sortText logic during the merge 
from upstream, let me fix that.


https://reviews.llvm.org/D38048



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


r314600 - [NFC] Add assertion that we assume a valid macro argument index.

2017-09-30 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Sat Sep 30 12:34:27 2017
New Revision: 314600

URL: http://llvm.org/viewvc/llvm-project?rev=314600=rev
Log:
[NFC] Add assertion that we assume a valid macro argument index.

Modified:
cfe/trunk/lib/Lex/MacroArgs.cpp

Modified: cfe/trunk/lib/Lex/MacroArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.cpp?rev=314600=314599=314600=diff
==
--- cfe/trunk/lib/Lex/MacroArgs.cpp (original)
+++ cfe/trunk/lib/Lex/MacroArgs.cpp Sat Sep 30 12:34:27 2017
@@ -118,10 +118,13 @@ unsigned MacroArgs::getArgLength(const T
 /// getUnexpArgument - Return the unexpanded tokens for the specified formal.
 ///
 const Token *MacroArgs::getUnexpArgument(unsigned Arg) const {
+
+  assert(Arg < getNumMacroArguments() && "Invalid arg #");
   // The unexpanded argument tokens start immediately after the MacroArgs 
object
   // in memory.
   const Token *Start = getTrailingObjects();
   const Token *Result = Start;
+  
   // Scan to find Arg.
   for (; Arg; ++Result) {
 assert(Result < Start+NumUnexpArgTokens && "Invalid arg #");


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


[PATCH] D38048: [clangd] Add textDocument/signatureHelp

2017-09-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols marked 4 inline comments as done.
rwols added a comment.

There were some failing tests, probably because we use an extra digit for the 
`sortText` property now. I haven't touched those tests.




Comment at: clangd/ClangdUnit.cpp:610
+ParameterInformation Info;
+OptionalParameterLabel = getOptionalString(*Chunk.Optional);
+Result.label += OptionalParameterLabel;

ilya-biryukov wrote:
> Are we first concatenating the `CodeCompletionString` inside optional chunks 
> and then trying to parse them again here?
> Can we extract `ProcessChunks` function and recursively call it with 
> `Chunk.Optional->Chunks`?
Yes, this was hokey. Fixed now (see the function `getOptionalParameters`)



Comment at: test/clangd/signature-help.test:39
+# I'm just putting the questionable result in here now as the expected result.
+# CHECK-DAG: {"label":"bar(float x = 0, int y = 42) -> 
void","parameters":[{"label":"float x = 0, int y = 42"}]}
+# 

ilya-biryukov wrote:
> rwols wrote:
> > When there are multiple defaulted parameters after each other, the 
> > CK_Optional chunk consists of *all* of those parameters, instead of a 
> > CK_Optional chunk per parameter. This might require us to dive into 
> > SemaCodeComplete.cpp to fix this. I'm just leaving it as-is right now.
> But does `CodeCompletionString` inside `Chunk->Optional` contain those extra 
> parameters as a separate chunk?
> 
Yes, they do. Thanks for the idea!


https://reviews.llvm.org/D38048



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


[PATCH] D38048: [clangd] Add textDocument/signatureHelp

2017-09-30 Thread Raoul Wols via Phabricator via cfe-commits
rwols updated this revision to Diff 117261.
rwols added a comment.

- Updated to latest upstream revision.
- Fix optional/default parameter handling: each default parameter now has its 
own label (thanks, ilya!).
- Remove the templated "invokeClangAction" function and use polymorphism with 
CodeCompleteConsumer instead. The function is now called "invokeCodeComplete".


https://reviews.llvm.org/D38048

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/ClangdUnit.cpp
  clangd/ClangdUnit.h
  clangd/Protocol.cpp
  clangd/Protocol.h
  clangd/ProtocolHandlers.cpp
  clangd/ProtocolHandlers.h
  test/clangd/formatting.test
  test/clangd/signature-help.test

Index: test/clangd/signature-help.test
===
--- /dev/null
+++ test/clangd/signature-help.test
@@ -0,0 +1,42 @@
+# RUN: clangd -run-synchronously < %s | FileCheck %s
+# It is absolutely vital that this file has CRLF line endings.
+
+# Start a session.
+Content-Length: 125
+
+{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
+
+# Modify the document.
+Content-Length: 333
+
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"void foo(int x, int y);\nvoid foo(int x, float y);\nvoid foo(float x, int y);\nvoid foo(float x, float y);\nvoid bar(int x, int y = 0);\nvoid bar(float x = 0, int y = 42);\nint main() { foo("}}}
+
+# Ask for signature help.
+Content-Length: 151
+
+{"jsonrpc":"2.0","id":1,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":8,"character":9}}}
+# CHECK: {"jsonrpc":"2.0","id":1,"result":{"activeSignature":0,"activeParameter":0,"signatures":[
+# CHECK-DAG: {"label":"foo(float x, float y) -> void","parameters":[{"label":"float x"},{"label":"float y"}]}
+# CHECK-DAG: {"label":"foo(float x, int y) -> void","parameters":[{"label":"float x"},{"label":"int y"}]}
+# CHECK-DAG: {"label":"foo(int x, float y) -> void","parameters":[{"label":"int x"},{"label":"float y"}]}
+# CHECK-DAG: {"label":"foo(int x, int y) -> void","parameters":[{"label":"int x"},{"label":"int y"}]}
+# CHECK: ]}
+
+# Modify the document
+Content-Length: 333
+
+{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":2,"text":"void foo(int x, int y);\nvoid foo(int x, float y);\nvoid foo(float x, int y);\nvoid foo(float x, float y);\nvoid bar(int x, int y = 0);\nvoid bar(float x = 0, int y = 42);\nint main() { bar("}}}
+
+# Ask for signature help (this checks default argument handling).
+Content-Length: 151
+
+{"jsonrpc":"2.0","id":2,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":8,"character":9}}}
+# CHECK: {"jsonrpc":"2.0","id":2,"result":{"activeSignature":0,"activeParameter":0,"signatures":[
+# CHECK-DAG: {"label":"bar(int x, int y = 0) -> void","parameters":[{"label":"int x"},{"label":"int y = 0"}]}
+# CHECK-DAG: {"label":"bar(float x = 0, int y = 42) -> void","parameters":[{"label":"float x = 0"},{"label":"int y = 42"}]}
+# CHECK: ]}
+
+# Shutdown.
+Content-Length: 49
+
+{"jsonrpc":"2.0","id":10,"method":"shutdown"}
Index: test/clangd/formatting.test
===
--- test/clangd/formatting.test
+++ test/clangd/formatting.test
@@ -4,7 +4,6 @@
 Content-Length: 125
 
 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
-# CHECK: Content-Length: 466
 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{
 # CHECK:   "textDocumentSync": 1,
 # CHECK:   "documentFormattingProvider": true,
Index: clangd/ProtocolHandlers.h
===
--- clangd/ProtocolHandlers.h
+++ clangd/ProtocolHandlers.h
@@ -47,6 +47,8 @@
 JSONOutput ) = 0;
   virtual void onCompletion(TextDocumentPositionParams Params, StringRef ID,
 JSONOutput ) = 0;
+  virtual void onSignatureHelp(TextDocumentPositionParams Params, StringRef ID,
+   JSONOutput ) = 0;
   virtual void onGoToDefinition(TextDocumentPositionParams Params, StringRef ID,
 JSONOutput ) = 0;
   virtual void onSwitchSourceHeader(TextDocumentIdentifier Params, StringRef ID,
Index: clangd/ProtocolHandlers.cpp
===
--- clangd/ProtocolHandlers.cpp
+++ clangd/ProtocolHandlers.cpp
@@ -192,6 +192,23 @@
   ProtocolCallbacks 
 };
 
+struct SignatureHelpHandler : Handler {
+  SignatureHelpHandler(JSONOutput , ProtocolCallbacks )
+  : Handler(Output), Callbacks(Callbacks) {}
+
+  void 

[clang-tools-extra] r314595 - [NFC] Sync function call with changes to interface made in r314593.

2017-09-30 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Sat Sep 30 07:36:00 2017
New Revision: 314595

URL: http://llvm.org/viewvc/llvm-project?rev=314595=rev
Log:
[NFC] Sync function call with changes to interface made in r314593.

Modified:
clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp

Modified: clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp?rev=314595=314594=314595=diff
==
--- clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp (original)
+++ clang-tools-extra/trunk/modularize/PreprocessorTracker.cpp Sat Sep 30 
07:36:00 2017
@@ -429,7 +429,7 @@ static std::string getMacroExpandedStrin
 const clang::Token *ArgTok = Args->getUnexpArgument(ArgNo);
 if (Args->ArgNeedsPreexpansion(ArgTok, PP))
   ResultArgToks = &(const_cast(Args))
-  ->getPreExpArgument(ArgNo, MI, PP)[0];
+  ->getPreExpArgument(ArgNo, PP)[0];
 else
   ResultArgToks = ArgTok; // Use non-preexpanded Tokens.
 // If the arg token didn't expand into anything, ignore it.


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


r314593 - [NFC] Remove superfluous parameter

2017-09-30 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Sat Sep 30 06:58:38 2017
New Revision: 314593

URL: http://llvm.org/viewvc/llvm-project?rev=314593=rev
Log:
[NFC] Remove superfluous parameter 
 - MacroArgs already knows the maximum number of arguments that can be supplied 
to the macro.  No need to pass MacroInfo (information about the macro 
definition) to the call to getPreExpArgument (which by the way might benefit 
from being called getExpandedArgument() ?) for it to compute the number of 
arguments.


Modified:
cfe/trunk/include/clang/Lex/MacroArgs.h
cfe/trunk/lib/Lex/MacroArgs.cpp
cfe/trunk/lib/Lex/TokenLexer.cpp

Modified: cfe/trunk/include/clang/Lex/MacroArgs.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/MacroArgs.h?rev=314593=314592=314593=diff
==
--- cfe/trunk/include/clang/Lex/MacroArgs.h (original)
+++ cfe/trunk/include/clang/Lex/MacroArgs.h Sat Sep 30 06:58:38 2017
@@ -93,7 +93,7 @@ public:
   /// getPreExpArgument - Return the pre-expanded form of the specified
   /// argument.
   const std::vector &
-getPreExpArgument(unsigned Arg, const MacroInfo *MI, Preprocessor );
+getPreExpArgument(unsigned Arg, Preprocessor );
 
   /// getStringifiedArgument - Compute, cache, and return the specified 
argument
   /// that has been 'stringified' as required by the # operator.

Modified: cfe/trunk/lib/Lex/MacroArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/MacroArgs.cpp?rev=314593=314592=314593=diff
==
--- cfe/trunk/lib/Lex/MacroArgs.cpp (original)
+++ cfe/trunk/lib/Lex/MacroArgs.cpp Sat Sep 30 06:58:38 2017
@@ -150,14 +150,13 @@ bool MacroArgs::ArgNeedsPreexpansion(con
 
 /// getPreExpArgument - Return the pre-expanded form of the specified
 /// argument.
-const std::vector &
-MacroArgs::getPreExpArgument(unsigned Arg, const MacroInfo *MI, 
- Preprocessor ) {
-  assert(Arg < MI->getNumParams() && "Invalid argument number!");
+const std::vector ::getPreExpArgument(unsigned Arg,
+   Preprocessor ) {
+  assert(Arg < getNumMacroArguments() && "Invalid argument number!");
 
   // If we have already computed this, return it.
-  if (PreExpArgTokens.size() < MI->getNumParams())
-PreExpArgTokens.resize(MI->getNumParams());
+  if (PreExpArgTokens.size() < getNumMacroArguments())
+PreExpArgTokens.resize(getNumMacroArguments());
   
   std::vector  = PreExpArgTokens[Arg];
   if (!Result.empty()) return Result;

Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=314593=314592=314593=diff
==
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Sat Sep 30 06:58:38 2017
@@ -275,7 +275,7 @@ void TokenLexer::ExpandFunctionArguments
   // avoids some work in common cases.
   const Token *ArgTok = ActualArgs->getUnexpArgument(ArgNo);
   if (ActualArgs->ArgNeedsPreexpansion(ArgTok, PP))
-ResultArgToks = >getPreExpArgument(ArgNo, Macro, PP)[0];
+ResultArgToks = >getPreExpArgument(ArgNo, PP)[0];
   else
 ResultArgToks = ArgTok;  // Use non-preexpanded tokens.
 


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


[PATCH] D38414: [clangd] simplify ClangdLSPServer by private-inheriting callback interfaces. NFC

2017-09-30 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL314587: [clangd] simplify ClangdLSPServer by 
private-inheriting callback interfaces. NFC (authored by sammccall).

Repository:
  rL LLVM

https://reviews.llvm.org/D38414

Files:
  clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
  clang-tools-extra/trunk/clangd/ClangdLSPServer.h

Index: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
===
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
@@ -9,7 +9,6 @@
 
 #include "ClangdLSPServer.h"
 #include "JSONRPCDispatcher.h"
-#include "ProtocolHandlers.h"
 
 using namespace clang::clangd;
 using namespace clang;
@@ -38,50 +37,8 @@
 
 } // namespace
 
-ClangdLSPServer::LSPDiagnosticsConsumer::LSPDiagnosticsConsumer(
-ClangdLSPServer )
-: Server(Server) {}
-
-void ClangdLSPServer::LSPDiagnosticsConsumer::onDiagnosticsReady(
-PathRef File, Tagged Diagnostics) {
-  Server.consumeDiagnostics(File, Diagnostics.Value);
-}
-
-class ClangdLSPServer::LSPProtocolCallbacks : public ProtocolCallbacks {
-public:
-  LSPProtocolCallbacks(ClangdLSPServer ) : LangServer(LangServer) {}
-
-  void onInitialize(StringRef ID, InitializeParams IP,
-JSONOutput ) override;
-  void onShutdown(JSONOutput ) override;
-  void onDocumentDidOpen(DidOpenTextDocumentParams Params,
- JSONOutput ) override;
-  void onDocumentDidChange(DidChangeTextDocumentParams Params,
-   JSONOutput ) override;
-  void onDocumentDidClose(DidCloseTextDocumentParams Params,
-  JSONOutput ) override;
-  void onDocumentOnTypeFormatting(DocumentOnTypeFormattingParams Params,
-  StringRef ID, JSONOutput ) override;
-  void onDocumentRangeFormatting(DocumentRangeFormattingParams Params,
- StringRef ID, JSONOutput ) override;
-  void onDocumentFormatting(DocumentFormattingParams Params, StringRef ID,
-JSONOutput ) override;
-  void onCodeAction(CodeActionParams Params, StringRef ID,
-JSONOutput ) override;
-  void onCompletion(TextDocumentPositionParams Params, StringRef ID,
-JSONOutput ) override;
-  void onGoToDefinition(TextDocumentPositionParams Params, StringRef ID,
-JSONOutput ) override;
-  void onSwitchSourceHeader(TextDocumentIdentifier Params, StringRef ID,
-JSONOutput ) override;  
-
-private:
-  ClangdLSPServer 
-};
-
-void ClangdLSPServer::LSPProtocolCallbacks::onInitialize(StringRef ID,
- InitializeParams IP,
- JSONOutput ) {
+void ClangdLSPServer::onInitialize(StringRef ID, InitializeParams IP,
+   JSONOutput ) {
   Out.writeMessage(
   R"({"jsonrpc":"2.0","id":)" + ID +
   R"(,"result":{"capabilities":{
@@ -94,79 +51,74 @@
   "definitionProvider": true
 }}})");
   if (IP.rootUri && !IP.rootUri->file.empty())
-LangServer.Server.setRootPath(IP.rootUri->file);
+Server.setRootPath(IP.rootUri->file);
   else if (IP.rootPath && !IP.rootPath->empty())
-LangServer.Server.setRootPath(*IP.rootPath);
+Server.setRootPath(*IP.rootPath);
 }
 
-void ClangdLSPServer::LSPProtocolCallbacks::onShutdown(JSONOutput ) {
-  LangServer.IsDone = true;
-}
+void ClangdLSPServer::onShutdown(JSONOutput ) { IsDone = true; }
 
-void ClangdLSPServer::LSPProtocolCallbacks::onDocumentDidOpen(
-DidOpenTextDocumentParams Params, JSONOutput ) {
+void ClangdLSPServer::onDocumentDidOpen(DidOpenTextDocumentParams Params,
+JSONOutput ) {
   if (Params.metadata && !Params.metadata->extraFlags.empty())
-LangServer.CDB.setExtraFlagsForFile(Params.textDocument.uri.file,
-std::move(Params.metadata->extraFlags));
-  LangServer.Server.addDocument(Params.textDocument.uri.file,
-Params.textDocument.text);
+CDB.setExtraFlagsForFile(Params.textDocument.uri.file,
+ std::move(Params.metadata->extraFlags));
+  Server.addDocument(Params.textDocument.uri.file, Params.textDocument.text);
 }
 
-void ClangdLSPServer::LSPProtocolCallbacks::onDocumentDidChange(
-DidChangeTextDocumentParams Params, JSONOutput ) {
+void ClangdLSPServer::onDocumentDidChange(DidChangeTextDocumentParams Params,
+  JSONOutput ) {
   // We only support full syncing right now.
-  LangServer.Server.addDocument(Params.textDocument.uri.file,
-Params.contentChanges[0].text);
+  Server.addDocument(Params.textDocument.uri.file,
+ 

[clang-tools-extra] r314587 - [clangd] simplify ClangdLSPServer by private-inheriting callback interfaces. NFC

2017-09-30 Thread Sam McCall via cfe-commits
Author: sammccall
Date: Sat Sep 30 03:08:52 2017
New Revision: 314587

URL: http://llvm.org/viewvc/llvm-project?rev=314587=rev
Log:
[clangd] simplify ClangdLSPServer by private-inheriting callback interfaces. NFC

Summary:
There doesn't seem to be any real separation between the current three objects.
Feel free to reject this if you find the current style valuable, though.

(Mostly I'm just looking around for cleanups to help me understand the code).

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
clang-tools-extra/trunk/clangd/ClangdLSPServer.h

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=314587=314586=314587=diff
==
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Sat Sep 30 03:08:52 2017
@@ -9,7 +9,6 @@
 
 #include "ClangdLSPServer.h"
 #include "JSONRPCDispatcher.h"
-#include "ProtocolHandlers.h"
 
 using namespace clang::clangd;
 using namespace clang;
@@ -38,50 +37,8 @@ replacementsToEdits(StringRef Code,
 
 } // namespace
 
-ClangdLSPServer::LSPDiagnosticsConsumer::LSPDiagnosticsConsumer(
-ClangdLSPServer )
-: Server(Server) {}
-
-void ClangdLSPServer::LSPDiagnosticsConsumer::onDiagnosticsReady(
-PathRef File, Tagged Diagnostics) {
-  Server.consumeDiagnostics(File, Diagnostics.Value);
-}
-
-class ClangdLSPServer::LSPProtocolCallbacks : public ProtocolCallbacks {
-public:
-  LSPProtocolCallbacks(ClangdLSPServer ) : LangServer(LangServer) {}
-
-  void onInitialize(StringRef ID, InitializeParams IP,
-JSONOutput ) override;
-  void onShutdown(JSONOutput ) override;
-  void onDocumentDidOpen(DidOpenTextDocumentParams Params,
- JSONOutput ) override;
-  void onDocumentDidChange(DidChangeTextDocumentParams Params,
-   JSONOutput ) override;
-  void onDocumentDidClose(DidCloseTextDocumentParams Params,
-  JSONOutput ) override;
-  void onDocumentOnTypeFormatting(DocumentOnTypeFormattingParams Params,
-  StringRef ID, JSONOutput ) override;
-  void onDocumentRangeFormatting(DocumentRangeFormattingParams Params,
- StringRef ID, JSONOutput ) override;
-  void onDocumentFormatting(DocumentFormattingParams Params, StringRef ID,
-JSONOutput ) override;
-  void onCodeAction(CodeActionParams Params, StringRef ID,
-JSONOutput ) override;
-  void onCompletion(TextDocumentPositionParams Params, StringRef ID,
-JSONOutput ) override;
-  void onGoToDefinition(TextDocumentPositionParams Params, StringRef ID,
-JSONOutput ) override;
-  void onSwitchSourceHeader(TextDocumentIdentifier Params, StringRef ID,
-JSONOutput ) override;  
-
-private:
-  ClangdLSPServer 
-};
-
-void ClangdLSPServer::LSPProtocolCallbacks::onInitialize(StringRef ID,
- InitializeParams IP,
- JSONOutput ) {
+void ClangdLSPServer::onInitialize(StringRef ID, InitializeParams IP,
+   JSONOutput ) {
   Out.writeMessage(
   R"({"jsonrpc":"2.0","id":)" + ID +
   R"(,"result":{"capabilities":{
@@ -94,79 +51,74 @@ void ClangdLSPServer::LSPProtocolCallbac
   "definitionProvider": true
 }}})");
   if (IP.rootUri && !IP.rootUri->file.empty())
-LangServer.Server.setRootPath(IP.rootUri->file);
+Server.setRootPath(IP.rootUri->file);
   else if (IP.rootPath && !IP.rootPath->empty())
-LangServer.Server.setRootPath(*IP.rootPath);
+Server.setRootPath(*IP.rootPath);
 }
 
-void ClangdLSPServer::LSPProtocolCallbacks::onShutdown(JSONOutput ) {
-  LangServer.IsDone = true;
-}
+void ClangdLSPServer::onShutdown(JSONOutput ) { IsDone = true; }
 
-void ClangdLSPServer::LSPProtocolCallbacks::onDocumentDidOpen(
-DidOpenTextDocumentParams Params, JSONOutput ) {
+void ClangdLSPServer::onDocumentDidOpen(DidOpenTextDocumentParams Params,
+JSONOutput ) {
   if (Params.metadata && !Params.metadata->extraFlags.empty())
-LangServer.CDB.setExtraFlagsForFile(Params.textDocument.uri.file,
-
std::move(Params.metadata->extraFlags));
-  LangServer.Server.addDocument(Params.textDocument.uri.file,
-Params.textDocument.text);
+CDB.setExtraFlagsForFile(Params.textDocument.uri.file,
+ std::move(Params.metadata->extraFlags));
+  

[PATCH] D38414: [clangd] simplify ClangdLSPServer by private-inheriting callback interfaces. NFC

2017-09-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 117256.
sammccall added a comment.

- Address review comments


https://reviews.llvm.org/D38414

Files:
  clangd/ClangdLSPServer.cpp
  clangd/ClangdLSPServer.h

Index: clangd/ClangdLSPServer.h
===
--- clangd/ClangdLSPServer.h
+++ clangd/ClangdLSPServer.h
@@ -14,6 +14,7 @@
 #include "GlobalCompilationDatabase.h"
 #include "Path.h"
 #include "Protocol.h"
+#include "ProtocolHandlers.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include "llvm/ADT/Optional.h"
 
@@ -24,7 +25,7 @@
 
 /// This class provides implementation of an LSP server, glueing the JSON
 /// dispatch and ClangdServer together.
-class ClangdLSPServer {
+class ClangdLSPServer : private DiagnosticsConsumer, private ProtocolCallbacks {
 public:
   ClangdLSPServer(JSONOutput , unsigned AsyncThreadsCount,
   bool SnippetCompletions,
@@ -37,18 +38,35 @@
   void run(std::istream );
 
 private:
-  class LSPProtocolCallbacks;
-  class LSPDiagnosticsConsumer : public DiagnosticsConsumer {
-  public:
-LSPDiagnosticsConsumer(ClangdLSPServer );
-
-virtual void
-onDiagnosticsReady(PathRef File,
-   Tagged Diagnostics);
-
-  private:
-ClangdLSPServer 
-  };
+  // Implement DiagnosticsConsumer.
+  virtual void
+  onDiagnosticsReady(PathRef File,
+ Tagged Diagnostics) override;
+
+  // Implement ProtocolCallbacks.
+  void onInitialize(StringRef ID, InitializeParams IP,
+JSONOutput ) override;
+  void onShutdown(JSONOutput ) override;
+  void onDocumentDidOpen(DidOpenTextDocumentParams Params,
+ JSONOutput ) override;
+  void onDocumentDidChange(DidChangeTextDocumentParams Params,
+   JSONOutput ) override;
+  void onDocumentDidClose(DidCloseTextDocumentParams Params,
+  JSONOutput ) override;
+  void onDocumentOnTypeFormatting(DocumentOnTypeFormattingParams Params,
+  StringRef ID, JSONOutput ) override;
+  void onDocumentRangeFormatting(DocumentRangeFormattingParams Params,
+ StringRef ID, JSONOutput ) override;
+  void onDocumentFormatting(DocumentFormattingParams Params, StringRef ID,
+JSONOutput ) override;
+  void onCodeAction(CodeActionParams Params, StringRef ID,
+JSONOutput ) override;
+  void onCompletion(TextDocumentPositionParams Params, StringRef ID,
+JSONOutput ) override;
+  void onGoToDefinition(TextDocumentPositionParams Params, StringRef ID,
+JSONOutput ) override;
+  void onSwitchSourceHeader(TextDocumentIdentifier Params, StringRef ID,
+JSONOutput ) override;
 
   std::vector
   getFixIts(StringRef File, const clangd::Diagnostic );
@@ -74,7 +92,6 @@
   // Various ClangdServer parameters go here. It's important they're created
   // before ClangdServer.
   DirectoryBasedGlobalCompilationDatabase CDB;
-  LSPDiagnosticsConsumer DiagConsumer;
   RealFileSystemProvider FSProvider;
 
   // Server must be the last member of the class to allow its destructor to exit
Index: clangd/ClangdLSPServer.cpp
===
--- clangd/ClangdLSPServer.cpp
+++ clangd/ClangdLSPServer.cpp
@@ -9,7 +9,6 @@
 
 #include "ClangdLSPServer.h"
 #include "JSONRPCDispatcher.h"
-#include "ProtocolHandlers.h"
 
 using namespace clang::clangd;
 using namespace clang;
@@ -38,50 +37,8 @@
 
 } // namespace
 
-ClangdLSPServer::LSPDiagnosticsConsumer::LSPDiagnosticsConsumer(
-ClangdLSPServer )
-: Server(Server) {}
-
-void ClangdLSPServer::LSPDiagnosticsConsumer::onDiagnosticsReady(
-PathRef File, Tagged Diagnostics) {
-  Server.consumeDiagnostics(File, Diagnostics.Value);
-}
-
-class ClangdLSPServer::LSPProtocolCallbacks : public ProtocolCallbacks {
-public:
-  LSPProtocolCallbacks(ClangdLSPServer ) : LangServer(LangServer) {}
-
-  void onInitialize(StringRef ID, InitializeParams IP,
-JSONOutput ) override;
-  void onShutdown(JSONOutput ) override;
-  void onDocumentDidOpen(DidOpenTextDocumentParams Params,
- JSONOutput ) override;
-  void onDocumentDidChange(DidChangeTextDocumentParams Params,
-   JSONOutput ) override;
-  void onDocumentDidClose(DidCloseTextDocumentParams Params,
-  JSONOutput ) override;
-  void onDocumentOnTypeFormatting(DocumentOnTypeFormattingParams Params,
-  StringRef ID, JSONOutput ) override;
-  void onDocumentRangeFormatting(DocumentRangeFormattingParams Params,
- StringRef ID, JSONOutput ) override;
-  void onDocumentFormatting(DocumentFormattingParams Params, StringRef ID,
-JSONOutput ) override;
-  void 

[PATCH] D38303: [Sema] Correct IUnknown to support Unknwnbase.h Header.

2017-09-30 Thread NAKAMURA Takumi via Phabricator via cfe-commits
chapuni added a comment.

Appeased in https://reviews.llvm.org/rL314586. I don't think my tweak would be 
right, though.

See;
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/6726
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/5135




Comment at: cfe/trunk/test/SemaCXX/ms-iunknown-template-function.cpp:18
+extern "C++" {
+// expected-warning@+1 {{__declspec attribute 'novtable'}}
+struct __declspec(uuid("---C000-0046")) 
__declspec(novtable)

This is not seen for targeting *-win32.
I wonder why you checked it here.


Repository:
  rL LLVM

https://reviews.llvm.org/D38303



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


r314586 - clang/test/SemaCXX/ms-iunknown-template-function.cpp: Appease for targeting *-win32.

2017-09-30 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Sat Sep 30 02:16:41 2017
New Revision: 314586

URL: http://llvm.org/viewvc/llvm-project?rev=314586=rev
Log:
clang/test/SemaCXX/ms-iunknown-template-function.cpp: Appease for targeting 
*-win32.

This expects the warning;

  File clang/test/SemaCXX/ms-iunknown-template-function.cpp Line 19: __declspec 
attribute 'novtable' is not supported

But for targeting *-win32, the warning is not seen.

  error: 'warning' diagnostics expected but not seen:
File clang\test\SemaCXX\ms-iunknown-template-function.cpp Line 19 
(directive at clang\test\SemaCXX\ms-iunknown-template-function.cpp:18): 
__declspec attribute 'novtable'

Modified:
cfe/trunk/test/SemaCXX/ms-iunknown-template-function.cpp

Modified: cfe/trunk/test/SemaCXX/ms-iunknown-template-function.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ms-iunknown-template-function.cpp?rev=314586=314585=314586=diff
==
--- cfe/trunk/test/SemaCXX/ms-iunknown-template-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/ms-iunknown-template-function.cpp Sat Sep 30 
02:16:41 2017
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s 
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify 
-fms-extensions %s
 typedef long HRESULT;
 typedef unsigned long ULONG;
 typedef struct _GUID {


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


[PATCH] D38441: [compiler-rt] [cmake] Add a separate CMake var to control profile runtime

2017-09-30 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
Herald added a subscriber: dberris.

Make it possible to control building profile runtime separately from
other options. Before r313549, the profile runtime building was
controlled along with sanitizers. However, since that commit it is built
unconditionally which results in multiple builds for people building
different runtimes separately.


Repository:
  rL LLVM

https://reviews.llvm.org/D38441

Files:
  CMakeLists.txt
  lib/CMakeLists.txt
  test/CMakeLists.txt


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 set(SANITIZER_COMMON_LIT_TEST_DEPS)
 
-if (COMPILER_RT_HAS_PROFILE)
+if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
   list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
 endif()
 
@@ -72,7 +72,7 @@
   endif()
 endforeach()
   endif()
-  if (COMPILER_RT_HAS_PROFILE)
+  if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
 compiler_rt_test_runtime(profile)
   endif()
   if(COMPILER_RT_BUILD_XRAY)
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -41,7 +41,7 @@
   endforeach()
 endif()
 
-if (COMPILER_RT_HAS_PROFILE)
+if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
   compiler_rt_build_runtime(profile)
 endif()
 
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -38,6 +38,8 @@
 mark_as_advanced(COMPILER_RT_BUILD_XRAY)
 option(COMPILER_RT_BUILD_LIBFUZZER "Build libFuzzer" ON)
 mark_as_advanced(COMPILER_RT_BUILD_LIBFUZZER)
+option(COMPILER_RT_BUILD_PROFILE "Build profile runtime" ON)
+mark_as_advanced(COMPILER_RT_BUILD_PROFILE)
 option(COMPILER_RT_BUILD_XRAY_NO_PREINIT "Build xray with no preinit patching" 
OFF)
 mark_as_advanced(COMPILER_RT_BUILD_XRAY_NO_PREINIT)
 


Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -10,7 +10,7 @@
 
 set(SANITIZER_COMMON_LIT_TEST_DEPS)
 
-if (COMPILER_RT_HAS_PROFILE)
+if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
   list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
 endif()
 
@@ -72,7 +72,7 @@
   endif()
 endforeach()
   endif()
-  if (COMPILER_RT_HAS_PROFILE)
+  if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
 compiler_rt_test_runtime(profile)
   endif()
   if(COMPILER_RT_BUILD_XRAY)
Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -41,7 +41,7 @@
   endforeach()
 endif()
 
-if (COMPILER_RT_HAS_PROFILE)
+if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE)
   compiler_rt_build_runtime(profile)
 endif()
 
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -38,6 +38,8 @@
 mark_as_advanced(COMPILER_RT_BUILD_XRAY)
 option(COMPILER_RT_BUILD_LIBFUZZER "Build libFuzzer" ON)
 mark_as_advanced(COMPILER_RT_BUILD_LIBFUZZER)
+option(COMPILER_RT_BUILD_PROFILE "Build profile runtime" ON)
+mark_as_advanced(COMPILER_RT_BUILD_PROFILE)
 option(COMPILER_RT_BUILD_XRAY_NO_PREINIT "Build xray with no preinit patching" OFF)
 mark_as_advanced(COMPILER_RT_BUILD_XRAY_NO_PREINIT)
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits