[PATCH] D27854: [analyzer] Add check for mutex acquisition during interrupt context in Magenta kernel

2016-12-17 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

This checker looks good to me! I don't see any obvious problems, and i think we 
can land it into non-alpha (enabled by default) once reviewers' comments are 
addressed.




Comment at: include/clang/StaticAnalyzer/Checkers/Checkers.td:78
 
+def Magenta : Package<"magenta">, InPackage;
+

`optin` is for checkers for which we cannot make a good guess if the user wants 
those or not.

Can we make a guess by looking at the target triple in this case? If we can, 
then it should not go into `optin`, but rather auto-enabled on specific 
platform, similarly to how it works for eg. `osx`.



Comment at: lib/StaticAnalyzer/Checkers/MagentaInterruptContextChecker.cpp:32
+  void reportMutexAcquisition(SymbolRef FileDescSym,
+const CallEvent &call,
+CheckerContext &C) const;

Indent slightly off.



Comment at: lib/StaticAnalyzer/Checkers/MagentaInterruptContextChecker.cpp:54
+  /// a call to that function.
+  void checkBeginFunction(CheckerContext &C) const;
+

To see if we're in an interrupt, take current `LocationContext` and see if its 
stack frame or a parent stack frame is for `x86_exception_handler`. I think you 
don't need a program state trait for that check - it's already in your location 
context - and `checkBeginFunction()`/`checkEndFunction()` can be removed. Also, 
as far as i remember (i may be wrong), `AnalysisDeclContext` will bring you the 
current top-level function declaration under analysis directly, without 
ascending the stack frames, if that's in fact all you need.

For exit-functions you'd still need a flag in the program state that says that 
there was an exit.



Comment at: lib/StaticAnalyzer/Checkers/MagentaInterruptContextChecker.cpp:93
+  ProgramStateRef State = C.getState();
+  unsigned inInterrupt = State->get();
+  if (!(FD->getName().compare(ExceptionHandler))) {

Probably a bool was intended. Also, this may be moved inside the assert body if 
not used anywhere else.



Comment at: lib/StaticAnalyzer/Checkers/MagentaInterruptContextChecker.cpp:109
+  ProgramStateRef State = C.getState();
+  if (!(FD->getName().compare(ExceptionHandler)))
+State = State->set(false);

I'd suggest to use `operator==` for such cases because it's easier to read.


https://reviews.llvm.org/D27854



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


[PATCH] D22507: Clang-tidy - Enum misuse check

2016-12-17 Thread Peter Szecsi via Phabricator via cfe-commits
szepet updated this revision to Diff 81848.
szepet added a comment.
Herald added a subscriber: JDevlieghere.

Minor changes to improve the readability of the code according to comments.


https://reviews.llvm.org/D22507

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/SuspiciousEnumUsageCheck.cpp
  clang-tidy/misc/SuspiciousEnumUsageCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-suspicious-enum-usage.rst
  test/clang-tidy/misc-suspicious-enum-usage-strict.cpp
  test/clang-tidy/misc-suspicious-enum-usage.cpp

Index: test/clang-tidy/misc-suspicious-enum-usage.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-suspicious-enum-usage.cpp
@@ -0,0 +1,90 @@
+// RUN: %check_clang_tidy %s misc-suspicious-enum-usage %t -- -config="{CheckOptions: [{key: misc-suspicious-enum-usage.StrictMode, value: 0}]}" --
+
+enum Empty {
+};
+
+enum A {
+  A = 1,
+  B = 2,
+  C = 4,
+  D = 8,
+  E = 16,
+  F = 32,
+  G = 63
+};
+
+enum X {
+  X = 8,
+  Y = 16,
+  Z = 4
+};
+
+enum {
+  P = 2,
+  Q = 3,
+  R = 4,
+  S = 8,
+  T = 16
+};
+
+enum {
+  H,
+  I,
+  J,
+  K,
+  L
+};
+
+enum Days {
+  Monday,
+  Tuesday,
+  Wednesday,
+  Thursday,
+  Friday,
+  Saturday,
+  Sunday
+};
+
+Days bestDay() {
+  return Friday;
+}
+
+int trigger() {
+  Empty EmptyVal;
+  int emptytest = EmptyVal | B;
+  if (bestDay() | A)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:17: warning: enum values are from different enum types 
+  if (I | Y)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: enum values are from different enum types
+}
+
+int dont_trigger() {
+  unsigned p;
+  p = Q | P;
+
+  if (A + G == E)
+return 1;
+  else if ((Q | R) == T)
+return 1;
+  else
+int k = T | Q;
+
+  Empty EmptyVal;
+  int emptytest = EmptyVal | B;
+
+  int a = 1, b = 5;
+  int c = a + b;
+  int d = c | H, e = b * a;
+  a = B | C;
+  b = X | Z;
+  
+  if (Tuesday != Monday + 1 ||
+  Friday - Thursday != 1 ||
+  Sunday + Wednesday == (Sunday | Wednesday))
+return 1;
+  if (H + I + L == 42)
+return 1;
+  return 42;
+}
Index: test/clang-tidy/misc-suspicious-enum-usage-strict.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-suspicious-enum-usage-strict.cpp
@@ -0,0 +1,94 @@
+// RUN: %check_clang_tidy %s misc-suspicious-enum-usage %t -- -config="{CheckOptions: [{key: misc-suspicious-enum-usage.StrictMode, value: 1}]}" --
+
+enum A {
+  A = 1,
+  B = 2,
+  C = 4,
+  D = 8,
+  E = 16,
+  F = 32,
+  G = 63
+};
+
+enum X {
+  X = 8,
+  Y = 16,
+  Z = 4,
+  ZZ = 3
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: enum type seems like a bitmask (contains mostly power-of-2 literals), but this literal is not a power-of-2 [misc-suspicious-enum-usage]
+// CHECK-MESSAGES: :68:13: note: used here as a bitmask
+};
+// CHECK-MESSAGES: :[[@LINE+2]]:1: warning: enum type seems like a bitmask (contains mostly power-of-2 literals) but some literal(s) are not a power-of-2
+  // CHECK-MESSAGES: :71:8: note: used here as a bitmask
+enum PP {
+  P = 2,
+  Q = 3,
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: enum type seems like a bitmask (contains mostly power-of-2 literals), but this literal is not a power-of-2
+  // CHECK-MESSAGES: :63:7: note: used here as a bitmask
+  R = 4,
+  S = 8,
+  T = 16,
+  U = 31
+};
+
+enum {
+  H,
+  I,
+  J,
+  K,
+  L
+};
+
+enum Days {
+  Monday,
+  Tuesday,
+  Wednesday,
+  Thursday,
+  Friday,
+  Saturday,
+  Sunday
+};
+
+Days bestDay() {
+  return Friday;
+}
+
+int trigger() {
+  if (bestDay() | A)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:17: warning: enum values are from different enum types
+  if (I | Y)
+return 1;
+  // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: enum values are from different enum types
+  if (P + Q == R)
+return 1;
+  else if ((Q | R) == T)
+return 1;
+  else
+int k = ZZ | Z;
+  unsigned p = R;
+  PP pp = Q;
+  p |= pp;
+  p = A | G;
+  return 0;
+}
+
+int dont_trigger() {
+  int a = 1, b = 5;
+  int c = a + b;
+  int d = c | H, e = b * a;
+  a = B | C;
+  b = X | Z;
+
+  unsigned bitflag;
+  enum A aa = B;
+  bitflag = aa | C;
+
+  if (Tuesday != Monday + 1 ||
+  Friday - Thursday != 1 ||
+  Sunday + Wednesday == (Sunday | Wednesday))
+return 1;
+  if (H + I + L == 42)
+return 1;
+  return 42;
+}
Index: docs/clang-tidy/checks/misc-suspicious-enum-usage.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-suspicious-enum-usage.rst
@@ -0,0 +1,80 @@
+.. title:: clang-tidy - misc-suspicious-enum-usage
+
+misc-suspicious-enum-usage
+==
+
+The checker detects various cases when an enum is probably misused (as a bitmask
+).
+  
+1. When "ADD" or "bitwise OR" is used between two enum which come from different
+   types and these types value ranges are not disjoint.
+
+The following case

[clang-tools-extra] r290051 - [clang-tidy] Remove duplicated check from move-constructor-init

2016-12-17 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Sat Dec 17 14:23:14 2016
New Revision: 290051

URL: http://llvm.org/viewvc/llvm-project?rev=290051&view=rev
Log:
[clang-tidy] Remove duplicated check from move-constructor-init

Summary:
An addition to the move-constructor-init check was duplicating the
modernize-pass-by-value check.
Remove the additional check and UseCERTSemantics option.
Run the move-constructor-init test with both checks enabled.
Fix modernize-pass-by-value false-positive when initializing a base
class.
Add option to modernize-pass-by-value to only warn about parameters
that are already values.

Reviewers: alexfh, flx, aaron.ballman

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h
clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h

clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst
clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp

Modified: clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp?rev=290051&r1=290050&r2=290051&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp Sat Dec 17 
14:23:14 2016
@@ -67,11 +67,6 @@ public:
 // MSC
 CheckFactories.registerCheck("cert-msc30-c");
   }
-  ClangTidyOptions getModuleOptions() override {
-ClangTidyOptions Options;
-Options.CheckOptions["cert-oop11-cpp.UseCERTSemantics"] = "1";
-return Options;
-  }
 };
 
 } // namespace cert

Modified: clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp?rev=290051&r1=290050&r2=290051&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp Sat 
Dec 17 14:23:14 2016
@@ -21,30 +21,11 @@ namespace clang {
 namespace tidy {
 namespace misc {
 
-namespace {
-
-unsigned int
-parmVarDeclRefExprOccurences(const ParmVarDecl &MovableParam,
- const CXXConstructorDecl &ConstructorDecl,
- ASTContext &Context) {
-  unsigned int Occurrences = 0;
-  auto AllDeclRefs =
-  findAll(declRefExpr(to(parmVarDecl(equalsNode(&MovableParam);
-  Occurrences += match(AllDeclRefs, *ConstructorDecl.getBody(), 
Context).size();
-  for (const auto *Initializer : ConstructorDecl.inits()) {
-Occurrences += match(AllDeclRefs, *Initializer->getInit(), Context).size();
-  }
-  return Occurrences;
-}
-
-} // namespace
-
 MoveConstructorInitCheck::MoveConstructorInitCheck(StringRef Name,
ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
   IncludeStyle(utils::IncludeSorter::parseIncludeStyle(
-  Options.get("IncludeStyle", "llvm"))),
-  UseCERTSemantics(Options.get("UseCERTSemantics", 0) != 0) {}
+  Options.get("IncludeStyle", "llvm"))) {}
 
 void MoveConstructorInitCheck::registerMatchers(MatchFinder *Finder) {
   // Only register the matchers for C++11; the functionality currently does not
@@ -63,68 +44,9 @@ void MoveConstructorInitCheck::registerM
 .bind("ctor")
 .bind("move-init",
   this);
-
-  auto NonConstValueMovableAndExpensiveToCopy =
-  qualType(allOf(unless(pointerType()), unless(isConstQualified()),
- hasDeclaration(cxxRecordDecl(hasMethod(cxxConstructorDecl(
- isMoveConstructor(), unless(isDeleted()),
- matchers::isExpensiveToCopy()));
-
-  // This checker is also used to implement cert-oop11-cpp, but when using that
-  // form of the checker, we do not want to diagnose movable parameters.
-  if (!UseCERTSemantics) {
-Finder->addMatcher(
-cxxConstructorDecl(
-allOf(
-unless(isMoveConstructor()),
-hasAnyConstructorInitializer(withInitializer(cxxConstructExpr(
-hasDeclaration(cxxConstructorDecl(isCopyConstructor())),
-hasArgument(
-0,
- 

[PATCH] D26453: [clang-tidy] Remove duplicated check from move-constructor-init

2016-12-17 Thread Malcolm Parsons via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290051: [clang-tidy] Remove duplicated check from 
move-constructor-init (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D26453?vs=78867&id=81849#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26453

Files:
  clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
  clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.cpp
  clang-tools-extra/trunk/clang-tidy/misc/MoveConstructorInitCheck.h
  clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
  clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.h
  clang-tools-extra/trunk/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
  clang-tools-extra/trunk/docs/ReleaseNotes.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/misc-move-constructor-init.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-pass-by-value.rst
  clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp

Index: clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-move-constructor-init.cpp
@@ -1,4 +1,7 @@
-// RUN: %check_clang_tidy %s misc-move-constructor-init %t -- -- -std=c++11 -isystem %S/Inputs/Headers
+// RUN: %check_clang_tidy %s misc-move-constructor-init,modernize-pass-by-value %t -- \
+// RUN: -config='{CheckOptions: \
+// RUN:  [{key: modernize-pass-by-value.ValuesOnly, value: 1}]}' \
+// RUN: -- -std=c++11 -isystem %S/Inputs/Headers
 
 #include 
 
@@ -28,8 +31,8 @@
   D() : B() {}
   D(const D &RHS) : B(RHS) {}
   // CHECK-MESSAGES: :[[@LINE+3]]:16: warning: move constructor initializes base class by calling a copy constructor [misc-move-constructor-init]
-  // CHECK-MESSAGES: 23:3: note: copy constructor being called
-  // CHECK-MESSAGES: 24:3: note: candidate move constructor here
+  // CHECK-MESSAGES: 26:3: note: copy constructor being called
+  // CHECK-MESSAGES: 27:3: note: candidate move constructor here
   D(D &&RHS) : B(RHS) {}
 };
 
@@ -96,7 +99,7 @@
 
 struct Positive {
   Positive(Movable M) : M_(M) {}
-  // CHECK-MESSAGES: [[@LINE-1]]:28: warning: value argument 'M' can be moved to avoid copy [misc-move-constructor-init]
+  // CHECK-MESSAGES: [[@LINE-1]]:12: warning: pass by value and use std::move [modernize-pass-by-value]
   // CHECK-FIXES: Positive(Movable M) : M_(std::move(M)) {}
   Movable M_;
 };
@@ -121,6 +124,7 @@
 };
 
 struct NegativeNotPassedByValue {
+  // This const ref constructor isn't warned about because the ValuesOnly option is set.
   NegativeNotPassedByValue(const Movable &M) : M_(M) {}
   NegativeNotPassedByValue(const Movable M) : M_(M) {}
   NegativeNotPassedByValue(Movable &M) : M_(M) {}
Index: clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
===
--- clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
+++ clang-tools-extra/trunk/clang-tidy/cert/CERTTidyModule.cpp
@@ -67,11 +67,6 @@
 // MSC
 CheckFactories.registerCheck("cert-msc30-c");
   }
-  ClangTidyOptions getModuleOptions() override {
-ClangTidyOptions Options;
-Options.CheckOptions["cert-oop11-cpp.UseCERTSemantics"] = "1";
-return Options;
-  }
 };
 
 } // namespace cert
Index: clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/PassByValueCheck.cpp
@@ -119,11 +119,13 @@
 PassByValueCheck::PassByValueCheck(StringRef Name, ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context),
   IncludeStyle(utils::IncludeSorter::parseIncludeStyle(
-  Options.get("IncludeStyle", "llvm"))) {}
+  Options.get("IncludeStyle", "llvm"))),
+  ValuesOnly(Options.get("ValuesOnly", 0) != 0) {}
 
 void PassByValueCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
   Options.store(Opts, "IncludeStyle",
 utils::IncludeSorter::toString(IncludeStyle));
+  Options.store(Opts, "ValuesOnly", ValuesOnly);
 }
 
 void PassByValueCheck::registerMatchers(MatchFinder *Finder) {
@@ -136,7 +138,8 @@
   cxxConstructorDecl(
   forEachConstructorInitializer(
   cxxCtorInitializer(
-  // Clang builds a CXXConstructExpr only whin it knows which
+  unless(isBaseInitializer()),
+  // Clang builds a CXXConstructExpr only when it knows which
   // constructor will be called. In dependent contexts a
   // ParenListExpr is generated instead of a CXXConstructExpr,
   // filtering out templates automatically for us.
@@ -147,7 +150,9 @@

[libcxx] r290052 - [CMake] Fix issue reported on sanitizer bots

2016-12-17 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Sat Dec 17 15:28:24 2016
New Revision: 290052

URL: http://llvm.org/viewvc/llvm-project?rev=290052&view=rev
Log:
[CMake] Fix issue reported on sanitizer bots

This should resolve an issue reported on the commit thread that impacted 
sanitizer bots.

Modified:
libcxx/trunk/include/CMakeLists.txt

Modified: libcxx/trunk/include/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=290052&r1=290051&r2=290052&view=diff
==
--- libcxx/trunk/include/CMakeLists.txt (original)
+++ libcxx/trunk/include/CMakeLists.txt Sat Dec 17 15:28:24 2016
@@ -10,7 +10,7 @@ set(LIBCXX_HEADER_PATTERN
   ${LIBCXX_SUPPORT_HEADER_PATTERN}
   )
 
-if(NOT LIBCXX_USING_INSTALLED_LLVM)
+if(NOT LIBCXX_USING_INSTALLED_LLVM AND LLVM_BINARY_DIR)
   file(COPY .
 DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
 FILES_MATCHING


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


[PATCH] D27546: [ASTReader] Sort RawComments before merging

2016-12-17 Thread Manman Ren via Phabricator via cfe-commits
manmanren accepted this revision.
manmanren added a comment.
This revision is now accepted and ready to land.

LGTM.

Manman


https://reviews.llvm.org/D27546



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


[PATCH] D27836: Store the "current position" index within the ASTRecordReader.

2016-12-17 Thread David L. Jones via Phabricator via cfe-commits
dlj added a comment.

Yeah, that makes more sense. Switched to readInt/peekInt/skipInts, let me know 
if you have a better idea for the names.


https://reviews.llvm.org/D27836



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


r290056 - Recommit r289979 [OpenCL] Allow disabling types and declarations associated with extensions

2016-12-17 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Sat Dec 17 23:18:55 2016
New Revision: 290056

URL: http://llvm.org/viewvc/llvm-project?rev=290056&view=rev
Log:
Recommit r289979 [OpenCL] Allow disabling types and declarations associated 
with extensions

Fixed undefined behavior due to cast integer to bool in initializer list.

Added:
cfe/trunk/test/CodeGenOpenCL/extension-begin.cl
cfe/trunk/test/SemaOpenCL/extension-begin.cl
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenCLImageTypes.def
cfe/trunk/include/clang/Basic/OpenCLOptions.h
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/include/clang/Sema/Overload.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/lib/Headers/opencl-c.h
cfe/trunk/lib/Parse/ParsePragma.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaCast.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/test/Parser/opencl-atomics-cl20.cl
cfe/trunk/test/Parser/opencl-pragma.cl
cfe/trunk/test/SemaOpenCL/extensions.cl

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=290056&r1=290055&r2=290056&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Sat Dec 17 23:18:55 
2016
@@ -968,8 +968,10 @@ def err_opencl_unroll_hint_on_non_loop :
 // OpenCL EXTENSION pragma (OpenCL 1.1 [9.1])
 def warn_pragma_expected_colon : Warning<
   "missing ':' after %0 - ignoring">, InGroup;
-def warn_pragma_expected_enable_disable : Warning<
-  "expected 'enable' or 'disable' - ignoring">, InGroup;
+def warn_pragma_expected_predicate : Warning<
+  "expected %select{'enable', 'disable', 'begin' or 'end'|'disable'}0 - 
ignoring">, InGroup;
+def warn_pragma_begin_end_mismatch : Warning<
+  "OpenCL extension end directive mismatches begin directive - ignoring">, 
InGroup;
 def warn_pragma_unknown_extension : Warning<
   "unknown OpenCL extension %0 - ignoring">, InGroup;
 def warn_pragma_unsupported_extension : Warning<

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=290056&r1=290055&r2=290056&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sat Dec 17 23:18:55 
2016
@@ -3359,6 +3359,8 @@ def note_ovl_candidate_has_pass_object_s
 "pass_object_size attribute">;
 def note_ovl_candidate_disabled_by_enable_if_attr : Note<
 "candidate disabled: %0">;
+def note_ovl_candidate_disabled_by_extension : Note<
+"candidate disabled due to OpenCL extension">;
 def err_addrof_function_disabled_by_enable_if_attr : Error<
 "cannot take address of function %0 becuase it has one or more "
 "non-tautological enable_if conditions">;
@@ -7936,8 +7938,6 @@ def ext_c99_array_usage : Extension<
 def err_c99_array_usage_cxx : Error<
   "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
   "feature, not permitted in C++">;
- def err_type_requires_extension : Error<
-  "use of type %0 requires %1 extension to be enabled">;
 def err_type_unsupported : Error<
   "%0 is not supported on this target">;
 def err_nsconsumed_attribute_mismatch : Error<
@@ -8143,6 +8143,8 @@ def warn_opencl_attr_deprecated_ignored
   InGroup;
 def err_opencl_variadic_function : Error<
   "invalid prototype, variadic arguments are not allowed in OpenCL">;
+def err_opencl_requires_extension : Error<
+  "use of %select{type |declaration}0%1 requires %2 extension to be enabled">;
 
 // OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
 def err_opencl_builtin_pipe_first_arg : Error<

Modified: cfe/trunk/include/clang/Basic/OpenCLImageTypes.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenCLImageTypes.def?rev=290056&r1=290055&r2=290056&view=diff
==
--- cfe/trunk/include/clang/Basic/OpenCLImageTypes.def (original)
+++ cfe/trunk/include/clang/Basic/OpenCLImageTypes.def Sat Dec 17 23:18:55 2016
@@ -7,73 +7,79 @@
 //
 
//===---

RE: r289991 - Revert r289979 due to regressions

2016-12-17 Thread Liu, Yaxun (Sam) via cfe-commits
Thanks.

Sam

From: Reid Kleckner [mailto:r...@google.com]
Sent: Friday, December 16, 2016 5:24 PM
To: Liu, Yaxun (Sam) 
Cc: cfe-commits 
Subject: Re: r289991 - Revert r289979 due to regressions

This revert broke the build because you failed to resolve conflicts in 
include/clang/Basic/OpenCLOptions.h caused by r289985. I've reverted that file 
in r289997.

On Fri, Dec 16, 2016 at 1:23 PM, Yaxun Liu via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Author: yaxunl
Date: Fri Dec 16 15:23:55 2016
New Revision: 289991
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27896: Remove the feature guards from the Clang intrinsics header files.

2016-12-17 Thread Elad Cohen via Phabricator via cfe-commits
eladcohen created this revision.
eladcohen added a subscriber: cfe-commits.

These were re-introduced to get better compile times in cases that don't 
actually require all the features. However, it creates compatibility issues 
with MSVC (in which all the intrinsics are available all the time).
With Clang's Modules feature we can remove these guards and still prevent large 
header files from compiling over and over again.

See also the thread "clang-cl's , _tzcnt_u32, and compatibility with 
MSVC's " in cfe-dev.


https://reviews.llvm.org/D27896

Files:
  lib/Headers/immintrin.h
  lib/Headers/x86intrin.h

Index: lib/Headers/immintrin.h
===
--- lib/Headers/immintrin.h
+++ lib/Headers/immintrin.h
@@ -24,45 +24,24 @@
 #ifndef __IMMINTRIN_H
 #define __IMMINTRIN_H
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || \
-(defined(__SSE4_2__) || defined(__SSE4_1__))
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || \
-(defined(__AES__) || defined(__PCLMUL__))
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__CLFLUSHOPT__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__)
 #include 
 
 /* The 256-bit versions of functions in f16cintrin.h.
@@ -112,90 +91,45 @@
 {
   return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
 }
-#endif /* __AVX2__ */
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || \
-(defined(__AVX512VL__) && defined(__AVX512BW__))
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || \
-(defined(__AVX512VL__) && defined(__AVX512CD__))
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || \
-(defined(__AVX512VL__) && defined(__AVX512DQ__))
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || \
-(defined(__AVX512IFMA__) && defined(__AVX512VL__))
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || \
-(defined(__AVX512VBMI__) && defined(__AVX512VL__))
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__)
 static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd")))
 _rdrand16_step(unsigned short *__p)
 {
@@ -227,9 +161,7 @@
   return __builtin_ia32_rdrand64_step(__p);
 }
 #endif
-#endif /* __RDRND__ */
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__)
 #ifdef __x86_64__
 static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase")))
 _readfsbase_u32(void)
@@ -280,36 +212,21 @@
 }
 
 #endif
-#endif /* __FSGSBASE__ */
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__)
 #include 
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHA__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FXSR__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVE__)
 #include 
-#endif
 
-#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAV

r290058 - Attempt to fix build failure and regressions due to r290056

2016-12-17 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Sun Dec 18 00:35:06 2016
New Revision: 290058

URL: http://llvm.org/viewvc/llvm-project?rev=290058&view=rev
Log:
Attempt to fix build failure and regressions due to r290056

Add llvm:: namespace to StringRef.
Make conversion between bool and uint64_t explicit.

Modified:
cfe/trunk/include/clang/Basic/OpenCLOptions.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/include/clang/Basic/OpenCLOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenCLOptions.h?rev=290058&r1=290057&r2=290058&view=diff
==
--- cfe/trunk/include/clang/Basic/OpenCLOptions.h (original)
+++ cfe/trunk/include/clang/Basic/OpenCLOptions.h Sun Dec 18 00:35:06 2016
@@ -32,24 +32,24 @@ class OpenCLOptions {
   };
   llvm::StringMap OptMap;
 public:
-  bool isKnown(StringRef Ext) const {
+  bool isKnown(llvm::StringRef Ext) const {
 return OptMap.find(Ext) != OptMap.end();
   }
 
-  bool isEnabled(StringRef Ext) const {
+  bool isEnabled(llvm::StringRef Ext) const {
 return OptMap.find(Ext)->second.Enabled;
   }
 
   // Is supported as either an extension or an (optional) core feature for
   // OpenCL version \p CLVer.
-  bool isSupported(StringRef Ext, unsigned CLVer) const {
+  bool isSupported(llvm::StringRef Ext, unsigned CLVer) const {
 auto I = OptMap.find(Ext)->getValue();
 return I.Supported && I.Avail <= CLVer;
   }
 
   // Is supported (optional) OpenCL core features for OpenCL version \p CLVer.
   // For supported extension, return false.
-  bool isSupportedCore(StringRef Ext, unsigned CLVer) const {
+  bool isSupportedCore(llvm::StringRef Ext, unsigned CLVer) const {
 auto I = OptMap.find(Ext)->getValue();
 return I.Supported && I.Avail <= CLVer &&
   I.Core != ~0U && CLVer >= I.Core;
@@ -57,13 +57,13 @@ public:
 
   // Is supported OpenCL extension for OpenCL version \p CLVer.
   // For supported (optional) core feature, return false.
- bool isSupportedExtension(StringRef Ext, unsigned CLVer) const {
+ bool isSupportedExtension(llvm::StringRef Ext, unsigned CLVer) const {
 auto I = OptMap.find(Ext)->getValue();
 return I.Supported && I.Avail <= CLVer &&
   (I.Core == ~0U || CLVer < I.Core);
   }
 
-  void enable(StringRef Ext, bool V = true) {
+  void enable(llvm::StringRef Ext, bool V = true) {
 OptMap[Ext].Enabled = V;
   }
 
@@ -71,7 +71,7 @@ public:
   /// \param Ext name of the extension optionally prefixed with
   ///'+' or '-'
   /// \param Enable used when \p Ext is not prefixed by '+' or '-'
-  void support(StringRef Ext, bool V = true) {
+  void support(llvm::StringRef Ext, bool V = true) {
 assert(!Ext.empty() && "Extension is empty.");
 
 switch (Ext[0]) {

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=290058&r1=290057&r2=290058&view=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sun Dec 18 00:35:06 2016
@@ -3167,8 +3167,8 @@ ASTReader::ReadASTBlock(ModuleFile &F, u
   for (unsigned I = 0, E = Record.size(); I != E; ) {
 auto Name = ReadString(Record, I);
 auto &Opt = OpenCLExtensions.OptMap[Name];
-Opt.Supported = Record[I++];
-Opt.Enabled = Record[I++];
+Opt.Supported = Record[I++] != 0;
+Opt.Enabled = Record[I++] != 0;
 Opt.Avail = Record[I++];
 Opt.Core = Record[I++];
   }

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=290058&r1=290057&r2=290058&view=diff
==
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Sun Dec 18 00:35:06 2016
@@ -3944,8 +3944,8 @@ void ASTWriter::WriteOpenCLExtensions(Se
   for (const auto &I:Opts.OptMap) {
 AddString(I.getKey(), Record);
 auto V = I.getValue();
-Record.push_back(V.Supported);
-Record.push_back(V.Enabled);
+Record.push_back(V.Supported ? 1 : 0);
+Record.push_back(V.Enabled ? 1 : 0);
 Record.push_back(V.Avail);
 Record.push_back(V.Core);
   }


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


[PATCH] D27897: [Modules] Enable the Modules language feature by default for the Clang builtins.

2016-12-17 Thread Elad Cohen via Phabricator via cfe-commits
eladcohen created this revision.
eladcohen added reviewers: rsmith, rnk, zvi, chandlerc, thakis.
eladcohen added a subscriber: cfe-commits.

The motivation is to reduce the compile time of the Clang intrinsics header 
files. Furthermore, this should allow us to remove the feature guards from 
these headers D27896  and solve some MSVC 
compatibility issues regarding intrinsics.

See also the threads "The intrinsics headers (especially avx512) are too big. 
What to do about it?" and "clang-cl's , _tzcnt_u32, and compatibility 
with MSVC's " in cfe-dev.


https://reviews.llvm.org/D27897

Files:
  lib/Driver/Tools.cpp
  test/Driver/modules.mm


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5615,11 +5615,26 @@
 CmdArgs.push_back("-fcoroutines-ts");
   }
 
+  // If modules is not asked for explicitly enable it exclusively
+  // for the Clang builtins in applicable cases.
+  bool HaveBuiltinModules = !Args.hasArg(options::OPT_fno_implicit_modules) &&
+!Args.hasArg(options::OPT_fmodules) &&
+!Args.hasArg(options::OPT_include) &&
+!isa(JA) &&
+((JA.getType() == types::TY_LLVM_BC) ||
+ (JA.getType() == types::TY_LLVM_IR) ||
+ (JA.getType() == types::TY_LTO_BC) ||
+ (JA.getType() == types::TY_LTO_IR) ||
+ (JA.getType() == types::TY_PP_Asm) ||
+ (JA.getType() == types::TY_Object) ||
+ (JA.getType() == types::TY_AST));
+
   // -fmodules enables the use of precompiled modules (off by default).
   // Users can pass -fno-cxx-modules to turn off modules support for
   // C++/Objective-C++ programs.
   bool HaveClangModules = false;
-  if (Args.hasFlag(options::OPT_fmodules, options::OPT_fno_modules, false)) {
+  if (Args.hasFlag(options::OPT_fmodules, options::OPT_fno_modules,
+   HaveBuiltinModules)) {
 bool AllowedInCXX = Args.hasFlag(options::OPT_fcxx_modules,
  options::OPT_fno_cxx_modules, true);
 if (AllowedInCXX || !types::isCXX(InputType)) {
@@ -5635,9 +5650,11 @@
   }
 
   // -fmodule-maps enables implicit reading of module map files. By default,
-  // this is enabled if we are using Clang's flavor of precompiled modules.
+  // this is enabled if Clang's flavor of precompiled modules is explicitly
+  // enabled.
   if (Args.hasFlag(options::OPT_fimplicit_module_maps,
-   options::OPT_fno_implicit_module_maps, HaveClangModules)) {
+   options::OPT_fno_implicit_module_maps,
+   HaveClangModules && !HaveBuiltinModules)) {
 CmdArgs.push_back("-fimplicit-module-maps");
   }
 
@@ -5701,7 +5718,8 @@
 
   // -fbuiltin-module-map can be used to load the clang
   // builtin headers modulemap file.
-  if (Args.hasArg(options::OPT_fbuiltin_module_map)) {
+  if (Args.hasArg(options::OPT_fbuiltin_module_map) ||
+ (HaveClangModules && HaveBuiltinModules)) {
 SmallString<128> BuiltinModuleMap(getToolChain().getDriver().ResourceDir);
 llvm::sys::path::append(BuiltinModuleMap, "include");
 llvm::sys::path::append(BuiltinModuleMap, "module.modulemap");
Index: test/Driver/modules.mm
===
--- test/Driver/modules.mm
+++ test/Driver/modules.mm
@@ -1,5 +1,8 @@
-// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MODULES %s
-// RUN: %clang -fcxx-modules -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-MODULES %s
+// RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-DEFAULT-MODULES %s
+// CHECK-DEFAULT-MODULES: -fmodules
+
+// RUN: %clang -fno-modules -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-MODULES %s
+// RUN: %clang -fno-cxx-modules -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-MODULES %s
 // RUN: %clang -fmodules -fno-cxx-modules -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-MODULES %s
 // CHECK-NO-MODULES-NOT: -fmodules
 


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5615,11 +5615,26 @@
 CmdArgs.push_back("-fcoroutines-ts");
   }
 
+  // If modules is not asked for explicitly enable it exclusively
+  // for the Clang builtins in applicable cases.
+  bool HaveBuiltinModules = !Args.hasArg(options::OPT_fno_implicit_modules) &&
+!Args.hasArg(options::OPT_fmodules) &&
+!Args.hasArg(options::OPT_include) &&
+!isa(JA) &&
+((JA.getType() == types::TY_LLVM_BC) ||
+ (JA.getType() == types::TY_LLVM_IR) ||
+ (JA.getType() == types::TY_LTO

r290059 - Fix a lit test issue exposed by r290056

2016-12-17 Thread Yaxun Liu via cfe-commits
Author: yaxunl
Date: Sun Dec 18 01:26:01 2016
New Revision: 290059

URL: http://llvm.org/viewvc/llvm-project?rev=290059&view=rev
Log:
Fix a lit test issue exposed by r290056

The test requests a target which supports cl_khr_gl_msaa_sharing since in 
test/PCH/ocl_types.h
it tries to enable cl_khr_gl_msaa_sharing. Therefore this test fails on targets 
not supporting
cl_khr_gl_msaa_sharing, e.g. ppc64, etc.

The fix is to add triple spir-unknown-unknown which supports 
cl_khr_gl_msaa_sharing.

Modified:
cfe/trunk/test/PCH/ocl_types.cl

Modified: cfe/trunk/test/PCH/ocl_types.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/ocl_types.cl?rev=290059&r1=290058&r2=290059&view=diff
==
--- cfe/trunk/test/PCH/ocl_types.cl (original)
+++ cfe/trunk/test/PCH/ocl_types.cl Sun Dec 18 01:26:01 2016
@@ -1,9 +1,9 @@
 // Test this without pch.
-// RUN: %clang_cc1 -include %S/ocl_types.h -fsyntax-only %s -cl-std=CL2.0 
-D__OPENCL_VERSION__=200
+// RUN: %clang_cc1 -triple spir-unknown-unknown -include %S/ocl_types.h 
-fsyntax-only %s -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 // Test with pch.
-// RUN: %clang_cc1 -x cl -emit-pch -o %t %S/ocl_types.h -cl-std=CL2.0 
-D__OPENCL_VERSION__=200
-// RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -ast-print -cl-std=CL2.0 
-D__OPENCL_VERSION__=200
+// RUN: %clang_cc1 -triple spir-unknown-unknown -x cl -emit-pch -o %t 
%S/ocl_types.h -cl-std=CL2.0 -D__OPENCL_VERSION__=200
+// RUN: %clang_cc1 -triple spir-unknown-unknown -include-pch %t -fsyntax-only 
%s -ast-print -cl-std=CL2.0 -D__OPENCL_VERSION__=200
 
 void foo1(img1d_t img);
 


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