diff options
| author | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2013-05-15 21:40:27 +0200 |
|---|---|---|
| committer | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2013-05-15 21:40:27 +0200 |
| commit | b0274c7c30af17c0255846bcd53cac4f7d76ddea (patch) | |
| tree | 4243e33459039a96c26557de48f989e85c925a4c /tools | |
| parent | 38f7a3147aad1e25d0738356519cf9235f5c80b7 (diff) | |
| parent | cce70c7c5f0f4c1a41658fbed845f8b3a565c99c (diff) | |
| download | clang-embtk-support-master.tar.gz clang-embtk-support-master.tar.bz2 clang-embtk-support-master.tar.xz | |
Merge branch 'master' into embtk-support-masterembtk-support-master
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/clang-format/clang-format.el | 44 | ||||
| -rw-r--r-- | tools/driver/cc1as_main.cpp | 6 | ||||
| -rw-r--r-- | tools/libclang/CIndex.cpp | 2 | ||||
| -rw-r--r-- | tools/libclang/CIndexUSRs.cpp | 7 | ||||
| -rw-r--r-- | tools/libclang/IndexingContext.cpp | 3 |
5 files changed, 38 insertions, 24 deletions
diff --git a/tools/clang-format/clang-format.el b/tools/clang-format/clang-format.el index b76eb41d94..57475ac722 100644 --- a/tools/clang-format/clang-format.el +++ b/tools/clang-format/clang-format.el @@ -7,25 +7,39 @@ ;; (global-set-key [C-M-tab] 'clang-format-region) ;; ;; Depending on your configuration and coding style, you might need to modify -;; 'style' and 'binary' below. +;; 'style' in clang-format, below. + +;; *Location of the clang-format binary. If it is on your PATH, a full path name +;; need not be specified. +(defvar clang-format-binary "clang-format") + (defun clang-format-region () + "Use clang-format to format the currently active region." (interactive) + (let ((beg (if mark-active + (region-beginning) + (min (line-beginning-position) (1- (point-max))))) + (end (if mark-active + (region-end) + (line-end-position)))) + (clang-format beg end))) + +(defun clang-format-buffer () + "Use clang-format to format the current buffer." + (clang-format (point-min) (point-max))) +(defun clang-format (begin end) + "Use clang-format to format the code between BEGIN and END." (let* ((orig-windows (get-buffer-window-list (current-buffer))) (orig-window-starts (mapcar #'window-start orig-windows)) (orig-point (point)) - (binary "clang-format") (style "LLVM")) - (if mark-active - (setq beg (region-beginning) - end (region-end)) - (setq beg (min (line-beginning-position) (1- (point-max))) - end (line-end-position))) - (call-process-region (point-min) (point-max) binary t t nil - "-offset" (number-to-string (1- beg)) - "-length" (number-to-string (- end beg)) - "-style" style) - (goto-char orig-point) - (dotimes (index (length orig-windows)) - (set-window-start (nth index orig-windows) - (nth index orig-window-starts))))) + (unwind-protect + (call-process-region (point-min) (point-max) clang-format-binary t t nil + "-offset" (number-to-string (1- begin)) + "-length" (number-to-string (- end begin)) + "-style" style) + (goto-char orig-point) + (dotimes (index (length orig-windows)) + (set-window-start (nth index orig-windows) + (nth index orig-window-starts)))))) diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index 232ea2f668..46ba2463f1 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -287,12 +287,12 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, // it later. SrcMgr.setIncludeDirs(Opts.IncludePaths); - OwningPtr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(Opts.Triple)); - assert(MAI && "Unable to create target asm info!"); - OwningPtr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(Opts.Triple)); assert(MRI && "Unable to create target register info!"); + OwningPtr<MCAsmInfo> MAI(TheTarget->createMCAsmInfo(*MRI, Opts.Triple)); + assert(MAI && "Unable to create target asm info!"); + bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj; formatted_raw_ostream *Out = GetOutputStream(Opts, Diags, IsBinary); if (!Out) diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index c25e625df5..71827f8a23 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -5681,7 +5681,7 @@ CXLinkageKind clang_getCursorLinkage(CXCursor cursor) { const Decl *D = cxcursor::getCursorDecl(cursor); if (const NamedDecl *ND = dyn_cast_or_null<NamedDecl>(D)) - switch (ND->getLinkage()) { + switch (ND->getLinkageInternal()) { case NoLinkage: return CXLinkage_NoLinkage; case InternalLinkage: return CXLinkage_Internal; case UniqueExternalLinkage: return CXLinkage_UniqueExternal; diff --git a/tools/libclang/CIndexUSRs.cpp b/tools/libclang/CIndexUSRs.cpp index a911ce5e95..4e47435996 100644 --- a/tools/libclang/CIndexUSRs.cpp +++ b/tools/libclang/CIndexUSRs.cpp @@ -151,7 +151,7 @@ bool USRGenerator::EmitDeclName(const NamedDecl *D) { } static inline bool ShouldGenerateLocation(const NamedDecl *D) { - return D->getLinkage() != ExternalLinkage; + return !D->isExternallyVisible(); } void USRGenerator::VisitDeclContext(const DeclContext *DC) { @@ -309,9 +309,8 @@ void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { // Ideally we would use 'GenObjCMethod', but this is such a hot path // for Objective-C code that we don't want to use // DeclarationName::getAsString(). - Out << (D->isInstanceMethod() ? "(im)" : "(cm)"); - DeclarationName N(D->getSelector()); - N.printName(Out); + Out << (D->isInstanceMethod() ? "(im)" : "(cm)") + << DeclarationName(D->getSelector()); } void USRGenerator::VisitObjCContainerDecl(const ObjCContainerDecl *D) { diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 14b430c7dc..cb9b492586 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/tools/libclang/IndexingContext.cpp @@ -210,11 +210,12 @@ bool IndexingContext::isFunctionLocalDecl(const Decl *D) { return false; if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) { - switch (ND->getLinkage()) { + switch (ND->getFormalLinkage()) { case NoLinkage: case InternalLinkage: return true; case UniqueExternalLinkage: + llvm_unreachable("Not a sema linkage"); case ExternalLinkage: return false; } |
